import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; import { ButtonIcon } from './button-icon'; # ButtonIcon The `ButtonIcon` is used for icons associated with a user action. ## Props The `ButtonIcon` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props ### Icon Name\* Use the required `iconName` prop with `ICON_NAMES` object from `./ui/components/component-library/icon` to select icon. Use the [IconSearch](/story/components-componentlibrary-icon--default-story) story to find the icon you want to use. ```jsx import { ButtonIcon } from '../ui/component-library'; import { ICON_NAMES } from '../icon'; ; ``` ### Size Use the `size` prop and the `SIZES` object from `./ui/helpers/constants/design-system.js` to change the size of `ButtonIcon`. Defaults to `SIZES.SM` Optional: `BUTTON_ICON_SIZES` from `./button-icon` object can be used instead of `SIZES`. Possible sizes include: - `SIZES.SM` 24px - `SIZES.LG` 32px ```jsx import { SIZES } from '../../../helpers/constants/design-system'; import { ButtonIcon } from '../ui/component-library'; ``` ### Aria Label Use the `ariaLabel` prop to set the name of the ButtonIcon for proper accessibility ```jsx import { ButtonIcon } from '../ui/component-library'; ``` ### As Use the `as` box prop to change the element of `ButtonIcon`. Defaults to `button`. Button `as` options: - `button` - `a` ```jsx import { ButtonIcon } from '../ui/component-library'; ``` ### Href When an `href` prop is passed it will change the element to an anchor(`a`) tag. ```jsx import { ButtonIcon } from '../ui/component-library'; ; ``` ### Color Use the `color` prop and the `COLORS` object to change the color of the `ButtonIcon`. Defaults to `COLORS.ICON_DEFAULT`. ```jsx import { ButtonIcon } from '../ui/component-library'; ; ``` ### Disabled Use the boolean `disabled` prop to disable button ```jsx import { ButtonIcon } from '../ui/component-library'; ; ```