IconButton
IconButton is used for buttons that show an icon in place of a text label.
Page navigation navigation
React examples
Default
Style variants
The IconButton component ships with different variants that visually reinforce hierarchy or intent. This example just shows the 'primary' variant.
Size variants
IconButtons can be rendered in different sizes. This example shows the 'small' size variant.
May be activated by a keyboard shortcut
Loading
Button loading state Loading pattern guidelines
Inactive
Button inactive state guidelines Degraded experiences pattern guidelines
More code examples
The previous examples are a curated subset of the full capabilities of the IconButton component. For more examples, see the IconButton Storybook stories.
Props
IconButton
| Name | Default | Description |
|---|---|---|
children Required | React.ReactNodeThis will be the Button description. | |
as | 'button' | React.ElementType |
href | stringMay only be used when | |
variant | 'default' | 'primary' | 'danger' | 'invisible' | 'link'Changes the look and feel of the button which is different for each variant | |
size | 'small' | 'medium' | 'large'Changes the size of the icon button component | |
inactive | booleanWhether the button looks visually disabled, but can still accept all the same interactions as an enabled button. | |
icon | Componentprovide an octicon. It will be placed in the center of the button | |
aria-label | stringUse an aria label to describe the functionality of the button. Please refer to our guidance on alt text for tips on writing good alternative text. | |
keyshortcuts Deprecated | stringUse | |
keybindingHint | stringOptional keybinding hint to show in the tooltip for this button. See the | |
tooltipDirection | 's' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw'The direction of the tooltip. |
description | stringIf | |
sx Deprecated | SystemStyleObject |