Icon Button
A compact icon-only native button.
A compact icon-only native button.
Import
Section titled “Import”import { IconButton } from "@zentara-co/zenos-ui";Icon-only buttons require an accessible name through aria-label. Pass tooltip to show a visible label on hover and keyboard focus. IconButton supports the shared variant and size="sm | md | lg" conventions, native button attributes, and ref forwarding.
Variants
Section titled “Variants”Icon buttons share the Button visual variants.
Custom styling
Section titled “Custom styling”Like Button, IconButton accepts your own appearance through the usual className prop. No custom variant or variantClassName is required. Define the surface, foreground, and interaction states you want to replace while retaining an accessible label and visible keyboard focus.
States
Section titled “States”Loading replaces the icon with a spinner, disables activation, and exposes aria-busy.
Tooltip
Section titled “Tooltip”tooltip shows a visible label on hover and keyboard focus, and closes with Escape. It opens immediately. tooltipVariant uses the same surfaces as Tooltip: default for a short label, solid for a longer note.
aria-label stays the accessible name. The tooltip does not replace it.
A disabled or loading icon button cannot be hovered or focused, so its tooltip stays closed. Keep any required explanation in text that remains on the page.
Motion
Section titled “Motion”Icon buttons use the same short pressed-state scale as Button and automatically remove it for reduced-motion preferences. Set disableMotion when another interaction already supplies feedback or the control must remain spatially still:
<IconButton aria-label="Add item" disableMotion> <PlusIcon /></IconButton>Pressed color, keyboard focus, and native activation remain available when motion is disabled. Icon buttons placed inside SplitButton disable pressed motion by default.
API
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | — | Required accessible name. |
Button / Link.variant | ButtonVariant | custom string | default | Visual treatment. |
variantClassName | string | — | Defines or refines the selected variant appearance. |
Button / Link.size | sm | md | lg | md | Square control size. |
isLoading | boolean | false | Shows progress and prevents activation. |
disableMotion | boolean | false | Disables the pressed-state scale and transition. Defaults to true inside SplitButton. |
tooltip | ReactNode | — | Visible label on hover and keyboard focus. Blank content is ignored. Disabled and loading buttons do not open it. |
tooltipVariant | default | solid | default | Tooltip surface. Matches Tooltip variants. |
native props | React.ButtonHTMLAttributes<HTMLButtonElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.