Skip to content
Content Blocks docsv0.8.0Website

Docs / Elements

<content-button>

A link or button. Wrapped around block content, such as a card, it makes the whole area clickable, and opens a content-overlay when its href points at one.

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

Examples

Three button styles

The same element styled as a solid button, an outline button and a text link.

Open on its own
Answer the call Join the watch Read the prophecy

Anatomy

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

flowchart LR
  root["#lt;content-button#gt;"]:::component
  root --> s0["<b>no slot (default)</b><br/>Default slot, same as content slot."]
  root --> s1["<b>slot=#quot;activatedContent#quot;</b><br/>If this slot is used, the content in this will be scrolled to and tri…"]
  root --> s2["<b>slot=#quot;content#quot;</b><br/>Inner contents of the button, usually plaintext."]
  classDef component fill:#141413,color:#faf9f5,stroke:#141413
The slots of <content-button>
SlotWhat goes in it
(default)Default slot, same as content slot.
slot="activatedContent"If this slot is used, the content in this will be scrolled to and triggered.
slot="content"Inner contents of the button, 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".
controlsTarget– /** Aria-controls value
expandedBoolean–Not documented yet
hrefURL–Not documented yet
link-classresponsiveString–Not documented yet
link-labelresponsiveString–Not documented yet
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".
targetString–Not documented yet