Button

From thedaviddias/ux-patterns-for-developers · View interactive version

Button is an AI agent skill from the GitHub repository thedaviddias/ux-patterns-for-developers. Use when you need to trigger actions and submit forms.

How to use this skill

Skill file

Button

Trigger actions and submit forms

What it solves

Buttons are interactive elements that trigger actions or events when clicked or interacted with.

When to use

When to avoid

Implementation workflow

  1. Confirm the pattern matches the problem and constraints before copying the example.
  2. Start from the anatomy and examples in references/pattern.md, then choose the smallest viable variation.
  3. Apply accessibility, performance, and interaction guardrails before layering visual polish.
  4. Use the testing guidance to verify behavior across keyboard, screen reader, responsive, and failure scenarios.

Accessibility guardrails

ARIA Attributes

Required ARIA attributes:

Screen Reader Support

Implementation example:

<!-- Icon-only button with proper ARIA -->
<button type="button" aria-label="Close dialog">
  <svg aria-hidden="true">
    <use href="#icon-close" />
  </svg>
</button>
<!-- Toggle button with ARIA pressed state -->
<button type="button" aria-pressed="false">
  <span>Dark mode</span>
</button>
<!-- Expandable content button -->
<button type="button" aria-expanded="false" aria-controls="content-1">
  <span>Show more</span>
</button>

Related patterns


For full implementation detail, examples, and testing notes, see references/pattern.md.

Pattern page: https://uxpatterns.dev/patterns/forms/button

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.