2022-10-06 06:51:02 +02:00
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import { ButtonPrimary } from './button-primary';
# ButtonPrimary
The `ButtonPrimary` is an extension of `ButtonBase` to support primary styles.
<Canvas>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-buttonprimary--default-story" />
2022-10-06 06:51:02 +02:00
</Canvas>
## Props
2023-01-20 20:27:46 +01:00
The `ButtonPrimary` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) and [ButtonBase](/docs/components-componentlibrary-buttonbase--default-story#props) component props
2022-10-06 06:51:02 +02:00
<ArgsTable of={ButtonPrimary} />
### Size
Use the `size` prop and the `SIZES` object from `./ui/helpers/constants/design-system.js` to change the size of `ButtonPrimary`. Defaults to `SIZES.MD`
Optional: `BUTTON_SIZES` from `./button-base` object can be used instead of `SIZES`.
Possible sizes include:
- `SIZES.SM` 32px
- `SIZES.MD` 40px
- `SIZES.LG` 48px
<Canvas>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-buttonprimary--size" />
2022-10-06 06:51:02 +02:00
</Canvas>
```jsx
import { SIZES } from '../../../helpers/constants/design-system';
2022-11-16 23:15:08 +01:00
import { ButtonPrimary } from '../../ui/components/component-library';
2022-10-06 06:51:02 +02:00
<ButtonPrimary size={SIZES.SM} />
<ButtonPrimary size={SIZES.MD} />
<ButtonPrimary size={SIZES.LG} />
```
2022-11-09 22:55:13 +01:00
### Danger
2022-10-06 06:51:02 +02:00
2022-11-09 22:55:13 +01:00
Use the `danger` boolean prop to change the `ButtonPrimary` to danger color.
2022-10-06 06:51:02 +02:00
<Canvas>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-buttonprimary--danger" />
2022-10-06 06:51:02 +02:00
</Canvas>
```jsx
2022-11-16 23:15:08 +01:00
import { ButtonPrimary } from '../../ui/components/component-library';
2022-10-06 06:51:02 +02:00
<ButtonPrimary>Normal</ButtonPrimary>
<ButtonPrimary danger>Danger</ButtonPrimary>
```