<content-line>
One line of text, such as a heading or a paragraph, with its tag, alignment and maximum width set per breakpoint.
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.
<content-line tag="h3" text-align="left|center" max-width="100%|420px">The horn has sounded</content-line>
<content-line tag="p" text-align="left|center" padding="0.75rem 0 0">Left on phones and centred from 768px, like the heading.</content-line>h3 {
font-size: 1.5rem;
font-weight: 700;
}// $ npm install @content-blocks/js
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-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
| Slot | What 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.
| 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". |
max-widthresponsive | String | '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. |
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". |
tag | Select | 'div' | The element tag to use. |
text-alignresponsive | Select | '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
