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
2023-02-14 18:33:04 +01:00
Use the `size` prop and the `Size` object from `./ui/helpers/constants/design-system.js` to change the size of `ButtonPrimary`. Defaults to `Size.MD`
2022-10-06 06:51:02 +02:00
2023-02-14 18:33:04 +01:00
Optional: `BUTTON_SIZES` from `./button-base` object can be used instead of `Size`.
2022-10-06 06:51:02 +02:00
Possible sizes include:
2023-02-14 18:33:04 +01:00
- `Size.SM` 32px
- `Size.MD` 40px
- `Size.LG` 48px
2022-10-06 06:51:02 +02:00
<Canvas>
2023-02-14 18:33:04 +01:00
<Story id="components-componentlibrary-buttonprimary--size-story" />
2022-10-06 06:51:02 +02:00
</Canvas>
```jsx
2023-02-02 21:15:26 +01:00
import { Size } from '../../../helpers/constants/design-system';
2023-01-25 20:54:08 +01:00
import { ButtonPrimary } from '../../component-library';
2022-10-06 06:51:02 +02:00
2023-02-02 21:15:26 +01:00
<ButtonPrimary size={Size.SM} />
<ButtonPrimary size={Size.MD} />
<ButtonPrimary size={Size.LG} />
2022-10-06 06:51:02 +02:00
```
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
2023-01-25 20:54:08 +01:00
import { ButtonPrimary } from '../../component-library';
2022-10-06 06:51:02 +02:00
<ButtonPrimary>Normal</ButtonPrimary>
<ButtonPrimary danger>Danger</ButtonPrimary>
```