Actions
Horizontal list of page-level actions (print, copy link, email, download, etc.) typically placed at the top or bottom of article content. Class-only: the .actions class is required on the <ul> wrapper. Supports two usage patterns: hand-authored HTML using the required class, and a Twig template that takes an array of item objects for CMS integration.
Usage
When to use
- Page-level actions on the currently viewed content - print, copy link, email, download PDF
- The top or bottom of an article or long-form page
- Anywhere a small, consistent row of action buttons/links fits
When not to use
- Linking to an organization's social profiles - use socials
- Primary navigation or utility nav in a site header
- A single button - use button directly
Do
- Keep the set short - Semetrika's core four are print, copy-link, email, download
- Pair every action with an icon and a visible text label
- Drop third-party widgets (AddToAny, Pocket) inside the same
.actionslist so they inherit the styling
Don't
- Use actions for page navigation
- Omit the visible text label - icon-only rows harm accessibility and recognition
- Stack actions vertically - the component is horizontal-only
API
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | array | - | Array of pre-rendered HTML strings, one per list item. |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Attributes
| Attribute | Set by | Required | Description |
|---|---|---|---|
data-actions | Consumer | Yes | Marks the actions list root; the click delegation for the action buttons binds to it. |
data-action | Consumer | - | On a descendant button, selects the helper to invoke. |
data-url | Consumer | - | Optional URL override for data-action="copy-link". Defaults to window.location.href. |
Events
| Event | Direction | Description |
|---|---|---|
actions-print | Emits | Fired after the print dialog has been triggered by a data-action="print" button. |
actions-link-copied | Emits | Fired after the current URL (or data-url override) has been copied to the clipboard. |
Accessibility
- WCAG 2.2 AA
- Each action is a real
<button>or<a>- native keyboard and focus handling - Visible text label is the accessible name; icons are decorative
- Copy-link confirmation is announced to screen readers
- Sufficient color contrast for text and hover state
- Visible
:focus-visibleoutline covering the full clickable item
Dependencies
- button - each action button inherits button styling as a base
- icon - provides the action icons
- tooltip - can optionally wrap actions for on-hover labels
Progressive enhancement
- No JS:
mailto:anddownloadlinks work natively; print and copy-link buttons are inert - With JS:
data-action="print"callswindow.print(),data-action="copy-link"uses the Clipboard API and shows an inline "Copied!" confirmation; dynamic action items are picked up automatically via event delegation - How to enable: include the actions helper (
src/components/actions/actions.js); it listens for clicks on[data-action]within any.actionscontainer