A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/ui/components/ui/button
Alex Donesky 3e2506b2e4
add space between sentences in insufficient currency warning (#14019)
3 years ago
..
README.mdx Updating storybook docs (#13055) 3 years ago
button.component.js Dark Theme setup and button theming (#13651) 3 years ago
button.stories.js Dark Theme setup and button theming (#13651) 3 years ago
button.stories.test.js Add storybook render tests with CI integration (#12477) 3 years ago
buttons.scss add space between sentences in insufficient currency warning (#14019) 3 years ago
index.js remove the ui/app and ui/lib folders (#10911) 4 years ago

README.mdx

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--type" />
</Canvas>

### Type Link

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">Click me</a>
```

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

### Icon

Pass an icon component to `icon` prop to add an icon to the left side of the Button.

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

## Submit

If the `submit` prop is set to `true` the html type attribute will be set to `type="submit"`

```html
<button class="button btn--rounded btn-primary" type="submit">Submit</button>
```

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

## OnClick

If the `onClick` prop is provided and is of type `function` the button html will render with `role="button"` and `tabIndex="0"` attributes. It also provides keyboard functionality on press of the "Enter" key.

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