<content-spacer>
Adds space around its content and limits its width, with its padding and maximum width set per breakpoint.
import '@content-blocks/js/components/content-spacer';Examples
A centred column
padding adds space around the content, and max-width centres a narrow column.
<content-spacer padding="1.5rem 1rem" max-width="360px" horizontal="center">
<content-line tag="p" padding="1rem">Nine winters we have kept the watch. This column is at most 360px wide, centred.</content-line>
</content-spacer>content-spacer {
background: #f1f5f9;
}
content-line {
background: #fff;
border: 1px dashed #94a3b8;
border-radius: 8px;
}// $ npm install @content-blocks/js
import '@content-blocks/js/components/content-spacer';
import '@content-blocks/js/components/content-line';<script type="module"
src="https://cdn.jsdelivr.net/npm/@content-blocks/js/dist/content-blocks/content-blocks.esm.js"></script>Anatomy
Content goes into the component's slots, chosen with the slot attribute on each child.
flowchart LR root["#lt;content-spacer#gt;"]:::component root --> s0["<b>no slot (default)</b><br/>Default slot, same as content slot."] root --> s1["<b>slot=#quot;content#quot;</b><br/>Inner contents of spacing wrapper, can be anything."] classDef component fill:#141413,color:#faf9f5,stroke:#141413
| Slot | What goes in it |
|---|---|
(default) | Default slot, same as content slot. |
slot="content" | Inner contents of spacing wrapper, can be anything. |
Properties
Set them as attributes. Those marked responsive take a value per breakpoint, separated by pipes and named or in order: 1|tablet=2 or 1|2. Seeresponsive values.
| Attribute | Type | Default | Description |
|---|---|---|---|
classesresponsive | String | – | Classes to add to the component. Use pipes for different classes per breakpoint, by name or in order: classes="stacked|laptop=side-by-side". |
full-heightresponsive | Boolean | 'false' | Pipe separated boolean values for full height. Typically, this is used if you have a hero block and you want a footer that aligns with the text layer. This is a niche case, but a valid one. |
horizontalresponsive | Select | 'default' | Pipe separated list of ContentLineTextAlignOptions for where to place text box when a max width is specified. |
max-widthresponsive | String | '100' | Pipe separated list of max width numbers. You can also use units such as "px" and "vw". |
paddingresponsive | String | – | Padding around the component, written as CSS padding. Use pipes for different padding per breakpoint, by name or in order: padding="1rem|tablet=2rem 4rem" or padding="1rem|2rem 4rem|3rem 5rem 4rem". |
text-alignresponsive | Select | 'default' | Pipe separated list of ContentLineTextAlignOptions for text alignment. |
verticalresponsive | Select | '' | Pipe separated list of ContentVerticalAlignments for text box placement. |
