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

IconButton

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

A square, icon-only button for compact actions such as Settings, Close or Delete row. 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). Every size meets the 24 px target minimum on web and the 44 pt / 48 dp touch targets on iOS and Android (2.5.8). Consumer duties: a specific, translated aria-label; a Tooltip with the same text when the icon's meaning is not obvious; and explaining why an action is unavailable instead of only disabling it. Use Button with a label when the icon is not universally understood.

import { IconButton } from "@nexera-ui/react";
Loading example…
5
examples
23
props
5
live controls
3
platforms
8
WCAG criteria
14
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…
variant
size
platform
isLoading
isDisabled
Generated code
import { IconButton } from "@nexera-ui/react";

<IconButton />

Examples 4

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, the name becomes "Settings Loading").

Loading example…

In context

Typical toolbar use: ghost buttons named by aria-label, and one named by visible text through aria-labelledby.

Loading example…

Platforms

Figma IconButton Mobile: platform="ios" raises the square to 44/50/56 pt (radius 12), platform="android" to 48/52/56 dp and makes it round; icons grow to 18/20/24.

Loading example…

Props 23

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

23 props shown

icon*Nexera
ReactNode

The icon. Decorative: the accessible name comes from aria-label or aria-labelledby. Wrap direction-bearing glyphs in DirectionalIcon so they flip in RTL.

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

Visual emphasis. destructive is reserved for irreversible actions.

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

Square size: 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. iOS and Android raise the size to the touch targets, use larger icons, and Android is fully round.

Default "web"
isLoadingNexera
boolean

Loading state. Replaces the icon with a spinner, stops presses and form submission, keeps focus and the square size, and adds loadingLabel to the accessible name (announced while focused).

Default false
loadingLabelNexera
string

Text added to the accessible name while isLoading is true ("Settings Loading"). 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 –
aria-labelNexera
string

Accessible name. Required unless aria-labelledby is set. Name the outcome ("Settings", "Delete row"), translate it, and show the same text in a Tooltip when the icon is not universally understood. Accessible name. Optional when aria-labelledby is set.

Default –
aria-labelledbyNexera
string

Id(s) of element(s) that name the button; wins over aria-label when both are set. Id(s) of visible element(s) that name the button. Required unless aria-label is set.

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-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.

WCAG 2.2 evidence

6 direct · 2 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.11Non-text ContrastLevel 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

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
<IconButton className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components