Icon button

Use an icon button to represent an action with an icon instead of a visible text label.

Ready to use
import {IconButton} from '@primer/react-brand'

Examples

Default

Loading

Custom icons

Pass an SVG element to use a custom icon.

Loading

Variants

IconButton inherits standard variants from Button and adds danger and invisible variants.

Loading

Sizes

Loading

Rounded

Use rounded for circular controls, such as a chat submit action.

Loading

In a ButtonGroup

Use variant="joined" to display related IconButton components.

Loading

In a toolbar

Use small icon buttons for familiar actions in compact toolbars.

Loading

In an ActionMenu

Use an icon button as the trigger when a familiar icon clearly communicates that contextual actions are available. The menu label also supplies the accessible name for the generated menu trigger.

Loading

Description

Use description to add supplementary information to the tooltip while keeping aria-label as the action name.

Loading

Delayed tooltip

Wrap IconButton in Tooltip with delay="long" when familiar controls appear in a dense group and immediate pointer tooltips would be distracting. Keyboard focus remains immediate.

Loading

Loading

Loading

Inactive

Inactive controls use the same muted style for every variant and retain focus and activation so they can explain why an action is unavailable. They render with aria-disabled="true" and must not perform their normal action.

Loading

Component props

NameTypeDefaultRequiredDescription
iconIcon | ReactElementtrueOcticon component or custom SVG element rendered in the center of the button
aria-labelstringtrueRequired non-empty accessible action name and default tooltip label
variant'primary', 'secondary', 'subtle', 'danger', 'invisible''secondary'falseButton variants plus IconButton-only danger and invisible variations
size'small', 'medium', 'large' | number'medium'falseNamed size or custom control dimensions in CSS pixels
descriptionstringundefinedfalseSupplementary tooltip description
tooltipDirection'nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w''s'falsePreferred tooltip direction
inactivebooleanfalsefalseApplies variant-independent muted styling while preserving input for required feedback
loadingbooleanfalsefalseReplaces the icon with a loading indicator and blocks activation without removing focus
loadingAnnouncementstring'Loading'falsePolite live-region message announced while loading
roundedbooleanfalsefalseRenders the control with a fully circular shape
disabledbooleanfalsefalseDisables the control using Button’s native or polymorphic behavior
asReact.ElementType'button'falseElement rendered by Button; provide href when rendering an anchor