Skip to content
v2.5.0
English
Русский
Documentation

Button

Button is the primary action component built on top of ButtonBase, with size and full-width behavior for common product actions.

Labeling

Button text should describe the action clearly. If the content is icon-only, use IconButton with an explicit aria-label instead.

Keyboard Behavior

AnnouncementFocus the demo and press a key from the table.
KeyAction
EnterSpaceActivates the focused button. It is a native <button>; with asChild the child element keeps its own keys, so a link reacts to Enter only.
Every row is checked in a real browser: Playwright presses the key in Chromium and checks where the focus and the active item land.
  • The pressed action should remain obvious from the text.
  • Polymorphic asChild usage should preserve a keyboard-usable interactive element.

Focus Behavior

  • Focus should land on the interactive root.
  • Visible focus treatment should remain intact after custom styling.

Screen Reader Semantics

  • The accessible name should come from visible text or supported labeling.
  • A button should remain a button unless the consumer intentionally switches semantics through asChild.

Form Semantics

  • There is no default type: like a native <button>, Button submits the surrounding form.
  • Set type='button' for actions that must not submit.
  • Use type='submit' deliberately when the button belongs to a form submit flow.

Accessibility Risks

  • Ambiguous text like "Continue" without surrounding context.
  • Using asChild with a child that loses interactive semantics.
  • Replacing text with a spinner or icon without preserving understandable meaning.