Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Icon Button
  3. Accessibility

Icon button

Accessibility

IconButton from @prepared911/ui-core renders a native <button> with an icon and a title that doubles as the accessible name and the hover/long-press tooltip. The component does the native button wiring; your job is to write a descriptive title for every instance and keep pressed / controlled state honest.

What the component handles

  • Native button semantics. <button> with all expected keyboard and screen-reader behavior.
  • Accessible name from title. The title prop renders as the hover tooltip and as the accessible name so screen readers and sighted users get the same meaning.
  • Focus indicator. Visible focus ring that meets contrast on both themes.
  • Disabled state. Applies the native disabled attribute.

What you must provide

  • title for every icon button. Required; it is the accessible name. Name the outcome ("Delete incident", not "Delete"). Include the target in dense contexts.
  • Toggle state when applicable. For two-state buttons, flip the title to describe the next action ("Unmute audio" when muted; "Mute audio" when unmuted) and expose aria-pressed.
  • aria-controls / aria-expanded when the button opens or toggles another region (menu, panel).
  • Confirmation on destructive actions. ButtonType.Destructive styling communicates intent visually; pair with a Modal confirmation for irreversible work.

Keyboard behavior

  • Tab / Shift+Tab move focus.
  • Enter / Space activate.
  • Disabled icon buttons are skipped.

Semantics and roles

  • Native <button>.
  • aria-pressed for toggles; aria-expanded + aria-controls for disclosure triggers.
  • aria-label may override title when the two must differ (rare—prefer identical strings).

Touch targets and responsive behavior

Standard size meets touch-target minimums. When using the small variant in dense toolbars, keep gap spacing around each button so touch users can target accurately.

Known caveats

  • Generic titles in table rows. "Delete", "Edit" in a row read identically across every row to a screen reader. Include the row's primary handle in the title via template ("Delete incident {id}").
  • Tooltip as the only context. Never. title is the accessible name; it reaches screen readers independent of the tooltip visually appearing.
  • Color-only state. Don't communicate toggle state through color alone. Change the icon or the label or both.

Previous

Icon Button / API and Development

Next

Icon Toggle / Usage

On this page

What the component handles
What you must provide
Keyboard behavior
Semantics and roles
Touch targets and responsive behavior
Known caveats