Icon Button

The Icon Button component renders a button with an icon. It supports various actions, including external links and loading states.

Usage

Default IconButton

<IconButton icon={FaPlus} ariaLabel="Add" />

Props

Data table
TypeDescription
aria-atomicbooleanIndicates whether screen readers should present all of a live region at once.
aria-busybooleanIndicates whether the button is busy, such as while loading.
aria-checkedboolean | "mixed"Indicates the current checked state when the icon button behaves like a checkable control.
aria-controlsstringIdentifies the element whose contents or presence are controlled by this button.
aria-currentboolean | "page" | "step" | "location" | "date" | "time"Indicates the current active item within a related set, when applicable.
aria-describedbystringOptional ID reference to one or more elements that describe this control.
aria-errormessagestringOptional ID reference to an error message element for this control.
aria-expandedbooleanIndicates whether the associated popup element is currently expanded.
aria-haspopupboolean | "dialog" | "grid" | "listbox" | "menu" | "tree"Indicates whether activating the control opens a popup element such as a menu or dialog.
aria-invalidbooleanIndicates whether the control is currently invalid.
aria-labelstringAccessible label for screen readers. Required for icon-only usage unless title is provided.
aria-labelledbystringOptional ID reference to one or more elements that label this control.
aria-live"off" | "polite" | "assertive"Indicates whether the element should be announced as live region content.
aria-pressedboolean | "mixed"Indicates the current pressed state for toggle-style icon buttons.
aria-selectedbooleanIndicates the current selected state when used in selectable patterns.
classNamestringCustom class name for additional styling.
data-testidstringOptional test ID for testing frameworks.
disabledbooleanWhether the button should be disabled.
hrefstringOptional href to turn the button into a link.
iconComponentType<{ className?: string; "aria-hidden"?: boolean; focusable?: boolean; "data-testid"?: string; }>Icon component to render inside the button. Should be a React component, e.g., from `react-icons`.
iconClassNamestringCustom class name for the icon.
idstringOptional id for the root button or link element.
isExternalbooleanIf true, opens the link in a new tab (used with `href`).
loadingbooleanWhether to show a loading spinner instead of the icon.
onClick((e: React.MouseEvent<HTMLElement>) => void)Click event handler for the button.
outlinebooleanWhether the button should use an outline style.
relstringOptional rel attribute for link mode.
roleReact.AriaRoleOptional role override for advanced accessible interaction patterns.
roundingRoundingTypeRounding style of the button. One of: "none" | "small" | "medium" | "large" | "full"
shadowShadowTypeShadow style of the button. One of: "none" | "light" | "medium" | "strong" | "intense"
sizeSizeTypeSize of the button. One of: "xs" | "small" | "medium" | "large" | "xl"
stateStateTypeState of the button. One of: "success" | "error" | "warning" | "disabled" | ""
tabIndexnumberOptional tab index override.
targetReact.HTMLAttributeAnchorTargetOptional target attribute for link mode.
themeThemeTypeTheme style of the button. One of: "primary" | "secondary" | "tertiary" | "quaternary" | "clear"
titlestringTitle attribute (native browser tooltip text).
tooltipstringTooltip text (not rendered automatically—use `title` for built-in browser tooltip).
type"button" | "reset" | "submit"Native button type. One of: "button" | "reset" | "submit"