IconButton

A compact action with a required spoken name.

  • Composed
  • Liquid Glass on iOS 26
  • In the first release
import { IconButton, iconButtonPrimitive } from "nitro-ui-sdk/icon-button";
HeroUI Native
Button (icon only)
Expo UI
IconButton
  • IconButton example screen, light appearance
    Light
  • IconButton example screen, dark appearance
    Dark
  • IconButton example screen, liquid glass appearance
    Liquid Glass
On this page

A button that shows only a glyph: add, share, more, play. It is a circle by default, shares its press, busy and haptic behavior with Button, and needs a label because the glyph is never spoken. Use CloseButton to dismiss, Button when the action has a word, and ToggleButton with iconOnly for an on/off glyph.

Anatomy

import { IconButton } from "nitro-ui-sdk/icon-button";

export function Anatomy() {
  return (
    <IconButton.Root label="Refresh" busyLabel="Refreshing" onPress={() => {}}>
      <IconButton.Icon>arrow.clockwise</IconButton.Icon>
      <IconButton.BusyIndicator />
    </IconButton.Root>
  );
}
Part Description
IconButton.Root The native pressable host: name, press, haptic, surface and feedback.
IconButton.Icon The decorative glyph: an SF Symbol name, an element or a drawing function. It hides while busy.
IconButton.BusyIndicator The platform spinner over the glyph, rendered only while busy.

With icon and no children the root renders Icon and BusyIndicator.

Usage

import { IconButton } from "nitro-ui-sdk/icon-button";

export function Share({ share }: { share: () => void }) {
  return <IconButton.Root label="Share" icon="square.and.arrow.up" onPress={share} />;
}

The glyph can also be a drawing function that receives the variant’s color and the size’s glyph width:

import { Text } from "nitro-ui-renderer";
import { IconButton } from "nitro-ui-sdk/icon-button";

export function Initial() {
  return (
    <IconButton.Root
      label="Account"
      variant="secondary"
      icon={({ color, size }) => (
        <Text fontSize={size} fontWeight="semibold" color={color}>
          {"A"}
        </Text>
      )}
      onPress={() => {}}
    />
  );
}

Variants and sizes

Variant Look
primary Solid accent fill.
secondary accentSoft fill.
tertiary (default) Neutral default fill.
ghost Transparent action with no border.
danger Solid danger fill.
glass Liquid Glass; falls back to the default fill.
Size Side (tokens.control) Glyph
sm 36 15
md (default) 44 19
lg 52 22

shape is circle (default) or rounded (a radius.control square). Small buttons keep a 44 × 44 pt touch area around the smaller circle.

States

  • Disabled: dims to opacity.disabled and refuses every press.
  • Busy: an async onPress or busy hides the glyph and shows the spinner in its place, so the size never changes. busyLabel is spoken as the value.
  • Pressed: the surface scales on touch. Live glass uses the system press effect. Reduce Motion dims the surface instantly.

Liquid Glass

glass draws an interactive MaterialView when the theme has glass on, the OS supports Liquid Glass (iOS 26) and Reduce Transparency is off; otherwise it draws the neutral default fill and scales. Use it over media and maps.

import { IconButton } from "nitro-ui-sdk/icon-button";

export function MapButton() {
  return <IconButton.Root label="Current location" icon="location.fill" variant="glass" onPress={() => {}} />;
}

Props

IconButton.Root

Prop Type Default Description
label string required The only name the control has.
icon IconButtonGlyph required unless children SF Symbol name, element or ({ color, size }) => ReactNode.
children ReactNode — Custom anatomy instead of icon.
onPress (details) => void | PromiseLike<unknown> required A returned promise shows the busy state.
variant IconButtonVariant "tertiary" See Variants.
size "sm" | "md" | "lg" "md" See Sizes.
shape "circle" | "rounded" "circle" Corner shape.
iconFallback ImageLoader — Image for Android and missing symbols.
disabled boolean false Refuses every press.
busy boolean false Shows the pending state from outside.
busyLabel string — Spoken after the name while busy.
hint string — Accessibility hint.
haptic "light" | "medium" | "heavy" | "none" "light" Impact felt on a touch press.
api Controller<IconButtonActions> — From iconButtonPrimitive.createApi().
agentId string — Stable identity for the agent registry.
confirm { message, approveLabel, cancelLabel } — Localized prompt shown before an agent presses. Required to expose press on danger.
styles IconButtonStyles — Per-part style resolvers.
layout LayoutProps — Layout of the host.

IconButton.Icon

Prop Type Default Description
children IconButtonGlyph root’s icon Decorative symbol or rendered glyph.
part IconButtonPart "icon" Selects the style resolver.

IconButton.BusyIndicator

Prop Type Default Description
children ReactNode platform spinner Content to show while busy.
part IconButtonPart "busyIndicator" Selects the style resolver.

Controller API

import { useState } from "react";
import { IconButton, iconButtonPrimitive } from "nitro-ui-sdk/icon-button";

export function Refresh({ reload }: { reload: () => Promise<void> }) {
  const [api] = useState(iconButtonPrimitive.createApi);
  return <IconButton.Root label="Refresh" icon="arrow.clockwise" api={api} onPress={reload} />;
}
Action Signature Result
press (source?: ActionSource) => ActionStatus accepted, disabled (disabled or busy) or refused.

Styles

import { IconButton, type IconButtonStyles } from "nitro-ui-sdk/icon-button";

const styles: IconButtonStyles = {
  root: ({ tokens, state }) => ({
    layout: { borderWidth: state.shape === "circle" ? 1 : 0 },
    style: { borderColor: tokens.colors.border },
  }),
  icon: ({ tokens }) => ({ text: { color: tokens.colors.accent } }),
};

export function Outlined() {
  return <IconButton.Root label="Edit" icon="pencil" styles={styles} onPress={() => {}} />;
}

Parts: root, icon, busyIndicator. The resolver receives { tokens, variant, size, state } with state: { disabled: boolean; busy: boolean; shape: "circle" | "rounded" }. The icon part’s text.color and text.fontSize color and size the glyph.

Accessibility

  • One element with the button trait named by label; the glyph is decorative.
  • Disabled and busy add notEnabled; busyLabel is the value while busy.
  • The touch area is at least 44 × 44 pt at every size.

Agent API

Action Arguments Notes
press none Same controller as touch; confirm asks the person first. Hidden while disabled or busy.

The entry has component: "IconButton", role: "button" and state: { disabled, busy }.

danger exposes press only with a localized confirm prompt. The button still appears in the snapshot with its role, name and state. Touch and controller presses work as usual.

Platform notes

iOS Android
Host KitPressable (shared with Button). PressableGroup with click listener and Button accessibility class.
Glyph SF Symbols. iconFallback image; symbols are not available.
Hit area Grows to 44 pt. The host reserves at least 44 display-independent pixels on each axis.
Glass Liquid Glass on iOS 26, opaque fallback otherwise. Opaque fallback.
Verification Unit, type and iOS harness tests. Kotlin implementation is unbuilt here (no Android NDK).

Breaking change from the previous version: the variants plain, tonal and destructive became ghost, tertiary and danger, and the default is tertiary.