Skip to content

Attributes

The attribute grammar keeps every pattern declarative. Mix and match contexts, plugins, and truthiness-aware class hooks without writing JavaScript.

🪄 Shorthand friendly: Prefer the canonical data-automagica11y- prefix in docs, but the runtime also accepts data-automagically-, data-ama11y-, data-ama-, and other supported aliases. All prefixes normalize before selectors or registries run.

Attribute reference
Attribute Type Allowed values Default Description
data-automagica11y-toggle string CSS selector, typically an #id Required Connects a trigger to its target surface.
data-automagica11y-context string `dialog`, `tooltip`, `menu`, custom aliases None Activates a named context that layers semantics and behaviors on top of toggle.
data-automagica11y-context-mode `all` | `semantics-only` | `behaviors-only` Mode tokens `all` Controls how much automation the context applies.
data-automagica11y-target string CSS selector or ID reference Next sibling Explicit override for the managed surface when using context syntax.
data-automagica11y-dialog string CSS selector or ID reference None Alias that forwards to the dialog context.
data-automagica11y-tooltip string CSS selector or ID reference None Alias that forwards to the tooltip context.
data-automagica11y-*-role string Any valid ARIA role Context defaults Override the auto-assigned role on the trigger or target (for example `data-automagica11y-target-role="alertdialog"`).
data-automagica11y-target-aria-* string Any ARIA attribute value Context defaults Override specific ARIA attributes on the target. The library merges these with its computed values.
data-automagica11y-trigger-aria-* string Any ARIA attribute value Context defaults Override ARIA attributes placed on the trigger (for example `data-automagica11y-trigger-aria-haspopup="menu"`).