Skip to content
Content Blocks docsv0.8.0Website

Docs / Formatters

<content-spacer>

Adds space around its content and limits its width, with its padding and maximum width set per breakpoint.

Import it on its own, for a bundler
import '@content-blocks/js/components/content-spacer';

Examples

A centred column

padding adds space around the content, and max-width centres a narrow column.

Open on its own
Nine winters we have kept the watch. This column is at most 360px wide, centred.

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
The slots of <content-spacer>
SlotWhat 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.

AttributeTypeDefaultDescription
classesresponsiveString–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-heightresponsiveBoolean'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.
horizontalresponsiveSelect

default · left · center · right

'default'Pipe separated list of ContentLineTextAlignOptions for where to place text box when a max width is specified.
max-widthresponsiveString'100'Pipe separated list of max width numbers. You can also use units such as "px" and "vw".
paddingresponsiveString–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-alignresponsiveSelect

default · left · center · right

'default'Pipe separated list of ContentLineTextAlignOptions for text alignment.
verticalresponsiveSelect

top · center · bottom · default

''Pipe separated list of ContentVerticalAlignments for text box placement.