IconButton composes the Button
component except that it renders only an icon.
Since IconButton
only renders an icon, you must pass the aria-label
prop, so
screen readers can give meaning to the button.
The IconButton
component accepts most of the props from the Button
component, so we can use colorScheme
prop to change the color of the button.
Like the Button component
, pass the size
prop to change the size of the
button.
Like the Button
component, pass the variant
prop to change the style of the
button.
You can also use icons from popular libraries like react-icons and just pass it into the button.
Name | Type | Description | Default |
---|---|---|---|
aria-label | string | A11y: A label that describes the button | - |
colorScheme | string | - | |
icon | React.ReactElement | The icon to be used in the button. | - |
isActive | boolean | If `true`, the button will be styled in its active state. | - |
isDisabled | boolean | If `true`, the button will be disabled. | - |
isLoading | boolean | If `true`, the button will show a spinner. | - |
isRound | boolean | If `true`, the button will be perfectly round. Else, it'll be slightly round | - |
size | string | - | |
spinner | React.ReactElement | Replace the spinner component when `isLoading` is set to `true` | - |
variant | string | - |