IconButton
IconButton is a button component that displays only an icon, making it ideal for compact interfaces and actions that don’t require text labels. It provides accessible, interactive icon buttons with hover and focus states.
Variants
Default Variant
The default variant provides a subtle hover state suitable for most icon button use cases.
<IconButton icon={Search} aria-label="Search" />Action Variant
The action variant provides a more prominent hover state with a blue background, ideal for primary icon actions.
<IconButton icon={Search} variant="action" aria-label="Search" />Sizes
Small (sm)
Small icon buttons are 30px × 30px, suitable for compact interfaces.
<IconButton icon={Search} size="sm" aria-label="Search" />Medium (md)
Medium icon buttons are 36px × 36px, the default size for most use cases.
<IconButton icon={Search} size="md" aria-label="Search" />Seamless
The seamless prop makes the icon button background transparent, useful for overlaying icons on images or colored backgrounds.
<IconButton icon={Search} seamless aria-label="Search" />Accessibility
IconButton requires an aria-label prop to ensure screen readers can identify the button’s purpose. Always provide a descriptive label that explains what action the button performs.
// Good<IconButton icon={Search} aria-label="Search" />
// Bad - missing aria-label<IconButton icon={Search} />Props
Custom icon renderer function. Allows complete control over icon rendering. Receives the icon and options, should return a React element. If provided, overrides the default icon rendering logic.
Whether the button is disabled.
Handler that is called when the press is released over the target.
Handler that is called when a press interaction starts.
Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
Handler that is called when the press state changes.
Handler that is called when a press is released over the target, regardless of whether it started on the target or not.
Not recommended – use onPress instead. onClick is an alias for onPress
provided for compatibility with other libraries. onPress provides
additional event details for non-mouse interactions.
Whether the element should receive focus on render.
Handler that is called when the element receives focus.
Handler that is called when the element loses focus.
Handler that is called when the element's focus status changes.
Handler that is called when a key is pressed.
Handler that is called when a key is released.
The behavior of the button when used in an HTML form.
Whether to prevent focus from moving to the button when pressing it.
Caution, this can make the button inaccessible and should only be used when alternative keyboard interaction is provided, such as ComboBox's MenuTrigger or a NumberField's increment/decrement control.
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.
The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner.
Indicates how to encode the form data that is submitted.
Indicates the HTTP method used to submit the form.
Indicates that the form is not to be validated when it is submitted.
Overrides the target attribute of the button's form owner.
Submitted as a pair with the button's value as part of the form data.
The value associated with the button's name when it's submitted with the form data.
Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
The element's unique identifier. See MDN.
Whether the button is in a pending state. This disables press and hover events while retaining focusability, and announces the pending state to screen readers.
Handler that is called when a hover interaction starts.
Handler that is called when a hover interaction ends.
Handler that is called when the hover state changes.
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null value indicates that the local props completely override all props received from a parent.
The CSS className for the element. A function may be provided to compute the class based on component state.
The inline style for the element. A function may be provided to compute the style based on component state.