Skip to main content

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 .actions list 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​

PropTypeDefaultDescription
itemsarray-Array of pre-rendered HTML strings, one per list item.
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Attributes​

AttributeSet byRequiredDescription
data-actionsConsumerYesMarks the actions list root; the click delegation for the action buttons binds to it.
data-actionConsumer-On a descendant button, selects the helper to invoke.
data-urlConsumer-Optional URL override for data-action="copy-link". Defaults to window.location.href.

Events​

EventDirectionDescription
actions-printEmitsFired after the print dialog has been triggered by a data-action="print" button.
actions-link-copiedEmitsFired 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-visible outline 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: and download links work natively; print and copy-link buttons are inert
  • With JS: data-action="print" calls window.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 .actions container
  • socials - different concept (organization social profile links, not page-level actions)
  • button - base styling for action buttons
  • icon - source of action icons
  • tooltip - optional hover labels