1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
George Marshall d72f7295a3
Docs/12367 Adding storybook essentials addons (#12393)
* Adding storybook essentials and documentation contribution guidelines

* Deprecation updates

* Update ui/2.DOCUMENTATION.stories.mdx

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>

* Updating spelling and adding label to i18n-party plugin in toolbar

Co-authored-by: kumavis <kumavis@users.noreply.github.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
2021-10-29 07:22:07 -10:00
..

import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';

import Button from '.';

# Button

Buttons communicate actions that users can take.

<Canvas>
  <Story id="ui-components-ui-button-button-stories-js--default-story" />
</Canvas>

## Component API

<ArgsTable of={Button} />

## Usage

The following describes the props and example usage for this component.

### Type

By changing the `type` prop you can use different styles of the button.

| type              | Description                                                                                           |
| ----------------- | ----------------------------------------------------------------------------------------------------- |
| `default`         | default style of the button                                                                           |
| `primary`         | the principle call to action on the page                                                              |
| `secondary`       | secondary actions on each page                                                                        |
| `warning`         | a warning action in the page                                                                          |
| `danger`          | a negative action (such as Delete) on the page                                                        |
| `danger--primary` | a negative principle call to action (such as Delete) on the page                                      |
| `link`            | an optional action or navigation action out of the app changes root html tag from `<button>` to `<a>` |

<Canvas>
  <Story id="ui-components-ui-button-button-stories-js--types" />
</Canvas>

### Link Type

By changing the `type` to `"link"` the root html element of the button changes from `<button>` to `<a>`.

Rendered html

```html
<a class="button btn-link" role="button" tabindex="0">Click me</a>
```

<Canvas>
  <Story id="ui-components-ui-button-button-stories-js--link-type" />
</Canvas>

### With Icon

Pass an icon component to `icon` prop to add an icon.

<Canvas>
  <Story id="ui-components-ui-button-button-stories-js--with-icon" />
</Canvas>