Button
A clickable button for actions, in a range of styles and sizes.
Usage
Examples
Variants
The variant prop sets the visual style. light is meant for dark or image backgrounds and is omitted below.
Sizes
With an icon
Mark an icon with data-icon="start" or data-icon="end" so the button reserves the right inner spacing. Use an icon-* size for an icon-only button, and always give it an aria-label.
Loading state
While an action is in flight, set disabled to block further clicks and swap the label to a Spinner. Add focusableWhenDisabled so focus stays on the button when it becomes disabled — without it, focus would jump to the body. Give the Spinner currentColor so it inherits the button's text color, and data-icon="start" so it gets the same inner spacing as an icon.
As a link
A link should stay a link. To make an <a> (or your router's <Link>) merely look like a button, apply the exported buttonVariants classes to it directly — don't render it through Button. See Composition → Links that look like a button.
Don't render a link through Button
Rendering an <a> through Button forces button semantics onto a link, which misleads assistive tech —
use buttonVariants on the link instead. The render prop with nativeButton={false} is only for
rendering as a non-interactive element (a <div> / <span>) where you still want button behavior.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior — roving focus, popup placement, and the like — follows the same direction.
For setup details and caveats, see the RTL guide.
API reference
Button wraps Base UI's Button and passes every remaining prop (onClick, type, aria-*, ref, …) straight through, so anything the Base UI primitive accepts works here — see its docs for the full API. Inside a ButtonGroup, variant and size are inherited from the group unless set on the button.
Accessibility
- Renders a native
<button>(or whatever you pass torender), so it is focusable and in the tab order by default. - Enter and Space activate the button.
disabledremoves the button from the tab order and setsdata-disabledfor styling; the pointer is disabled viapointer-events-none.- Icon-only buttons have no text, so give them an
aria-label. - All press and hover transitions are wrapped in
motion-reduce:variants, so they are skipped when the user prefers reduced motion.