Skip to content
Content Blocks docsv0.8.0Website

Docs / Elements

<content-line>

One line of text, such as a heading or a paragraph, with its tag, alignment and maximum width set per breakpoint.

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

Examples

Headings and alignment

content-line picks the tag, the alignment and the line length, each per breakpoint.

Open on its own
The horn has sounded Left on phones and centred from 768px, like the heading.

Anatomy

Content goes into the component's slots, chosen with the slot attribute on each child.

flowchart LR
  root["#lt;content-line#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 the line, usually plaintext."]
  classDef component fill:#141413,color:#faf9f5,stroke:#141413
The slots of <content-line>
SlotWhat goes in it
(default)Default slot, same as content slot.
slot="content"Inner contents of the line, usually plaintext.

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".
max-widthresponsiveString'100%'Pipe separated list of max width numbers. You can also use units such as "px" and "vw". If no unit is provided, defaults to percentage.
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".
tagSelect

div · p · h1 · h2 · h3 · h4 · h5 · h6 · span · section · article

'div'The element tag to use.
text-alignresponsiveSelect

default · left · center · right

'default'Pipe separated list of ContentLineTextAlignOptions for text alignment.
flowchart LR
  v["max-width=#quot;100%|420px#quot;"]:::value
  v --> b0["mobile, from 0px: 100%"]
  v --> b1["tablet and up, from 768px: 420px"]
  classDef value fill:#1d4ed8,color:#fff,stroke:#1d4ed8
How max-width="100%|420px" from the examples applies at each breakpoint