Components
CloseButton
CloseButton is a button with a close icon used to handle the close functionality in feedback and overlay components like Alerts, Toasts, Drawers and Modals.
Import
import { CloseButton } from '@outfitio/outkit';
Usage
Button Size
Use the size prop to change the size of the button. You can set the value to sm, md, or lg.
Accessibility
- The close button component semantically renders as
<button>. - Close buttons use browser defaults for keyboard interaction. Give buttons keyboard focus with the tab key (or shift + tab when tabbing backwards). Activate buttons with the enter / return or space key
Best Practice
- When used in a modal or drawer, the close button should not be focused by default.
Props
The CloseButton composes PseudoBox component.
| Name | Type | Default | Description |
|---|---|---|---|
aria-label | string | An accessible label for the close button | |
isDisabled | boolean | If true, the button will be disabled | |
color | string | The color of the close icon | |
size | sm, md, lg | md | The size of the close button |