Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Button

  • Stable
  • WCAG 2.2 evidence
  • RTL
  • Web · iOS · Android

Triggers an action such as Save, Submit, Approve or Delete. Built on React Aria Button: Enter and Space activate, disabled buttons leave the tab order, and keyboard focus shows the focus ring (WCAG 2.1.1, 2.4.7, 4.1.2).

import { Button } from "@nexera-ui/react";
Loading example…
6
examples
25
props
6
live controls
3
platforms
11
WCAG criteria
86
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
children
variant
size
platform
isLoading
isDisabled
Generated code
import { Button } from "@nexera-ui/react";

<Button />

Examples 5

The same examples as Storybook, rendered live. Open Code to copy one.

Variants and sizes

Every Figma Variant and Size on the web platform. Hover, press and focus the buttons to see the other states.

Loading example…

Disabled and loading

Figma Disabled state (isDisabled) and Loading state (isLoading).

Loading example…

With icons

leadingIcon and trailingIcon slots.

Loading example…

Platforms

Figma Button Mobile: platform="ios" and platform="android" raise the heights to 44/50/56 pt and 48/52/56 dp.

Loading example…

Long label and full width

Labels wrap instead of truncating (translation can add 30 to 40%); give the button width with className="w-full".

Loading example…

Props 25

Press "Try it" on a card to load that prop into the playground.

25 props shown

children*Nexera
ReactNode

Visible label. Use a verb that names the outcome ("Send invite"); never truncated. Icon-only buttons use IconButton instead, so the accessible name is always the label.

Default –
variantNexera
"primary" | "secondary" | "ghost" | "destructive"

Visual emphasis. destructive is reserved for irreversible actions.

Default "primary"
sizeNexera
"sm" | "md" | "lg"

Height and padding. Heights follow the platform control tokens: 32 / 40 / 48 px on web, 44 / 50 / 56 pt on iOS, 48 / 52 / 56 dp on Android.

Default "sm"
platformNexera
"web" | "ios" | "android"

Platform look. Defaults to the NexeraProvider platform.

Default "web"
leadingIconNexera
ReactNode

Icon before the label. Shown when provided; replaced by the spinner while loading.

Default –
trailingIconNexera
ReactNode

Icon after the label. Hidden while loading.

Default –
isLoadingNexera
boolean

Loading state. Shows a spinner, stops presses and form submission, keeps focus, and announces the state to assistive technology.

Default false
loadingLabelNexera
string

Text announced to assistive technology while isLoading is true (appended to the label). Translate it for your locale.

Default Loading
classNameNexera
string

Extra classes, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style.

Default –
isDisabledReact Aria
boolean

Whether the button is disabled.

Default –
onPressReact Aria
(e: PressEvent) => void

Handler that is called when the press is released over the target.

Default –
onPressStartReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction starts.

Default –
onPressEndReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.

Default –
onPressChangeReact Aria
(isPressed: boolean) => void

Handler that is called when the press state changes.

Default –
onPressUpReact Aria
(e: PressEvent) => void

Handler that is called when a press is released over the target, regardless of whether it started on the target or not.

Default –
autoFocusReact Aria
boolean

Whether the element should receive focus on render.

Default –
typeReact Aria
"button" | "submit" | "reset"

The behavior of the button when used in an HTML form.

Default 'button'
formReact Aria
string

The <form> element to associate the button with. The value of this attribute must be the id of a <form> in the same document. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#form).

Default –
nameReact Aria
string

Submitted as a pair with the button's value as part of the form data.

Default –
valueReact Aria
string

The value associated with the button's name when it's submitted with the form data.

Default –
idReact Aria
string

The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

Default –
aria-labelReact Aria
string

Defines a string value that labels the current element.

Default –
aria-labelledbyReact Aria
string

Identifies the element (or elements) that labels the current element.

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

Keyboard support
KeyAction
SpaceActivates the button
EnterActivates the button
TabMoves focus to the button. Disabled buttons are skipped.
Shift + TabMoves focus to the previous element
  • The visible label is the accessible name. Use IconButton for icon-only buttons so a name is always required.
  • While loading, the button stays focusable, ignores presses and announces the loading label.
  • The focus ring only shows for keyboard focus, never for mouse clicks.
  • Touch targets meet WCAG 2.5.8: 32 px on web, 44 pt or more on mobile.

WCAG 2.2 evidence

6 direct · 5 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.1Use of ColorLevel A · supporting test
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · tested directly
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly
  • 4.1.3Status MessagesLevel AA · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner
Sizes per platform
sizeWebiOSAndroid
sm32 px44 pt48 dp
md40 px50 pt52 dp
lg48 px56 pt56 dp

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-focus-visible
  • data-hovered
  • data-pending
  • data-pressed
Usage
<Button className="data-disabled:opacity-90 shadow-sm" />

Do and don't

DoName the outcome: "Send invite", "Approve leave".

Don'tUse vague labels like "OK", "Submit" or "Click here".

DoUse one primary button per view.

Don'tPut several primary buttons side by side.

DoUse destructive only for actions that cannot be undone.

Don'tMake every delete or remove action red.

DoLet long labels wrap, and go full width on phones.

Don'tTruncate labels with an ellipsis.

DoUse IconButton when there is no visible text.

Don'tLeave a Button with only an icon inside it.

Used in blocks

Related components