Skip to content

Commit

Permalink
Docs: Button component (#8226)
Browse files Browse the repository at this point in the history
* Update button docs

* Update README.md
  • Loading branch information
Soean authored and gziolo committed Aug 1, 2018
1 parent 1b89c8c commit 48e9e04
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions packages/components/src/button/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
This component is used to implement dang sweet buttons.
# Button

#### Props
Buttons express what action will occur when the user clicks or taps it. Buttons are used to trigger an action, and they can be used for any type of action, including navigation.

The following props are used to control the display of the component. Any additional props will be passed to the rendered `<a />` or `<button />` element. The presence of a `href` prop determines whether an anchor element is rendered instead of a button.
The presence of a `href` prop determines whether an `anchor` element is rendered instead of a `button`.

* `isPrimary`: (bool) whether the button is styled as a primary button.
* `href`: (string) if this property is added, it will use an `a` rather than a `button` element.
## Usage

Renders a button with default style.

```jsx
/**
* WordPress dependencies
*/
import { Button } from "@wordpress/components";

export default function ClickMeButton() {
return (
<Button isDefault>
Click me!
</Button>
);
}
```

## Props

Name | Type | Default | Description
--- | --- | --- | ---
`href` | `string` | `undefined` | If provided, renders `a` instead of `button`.
`isDefault` | `bool` | `false` | Renders a default button style.
`isPrimary` | `bool` | `false` | Renders a primary button style.
`isLarge` | `bool` | `false` | Increases the size of the button.
`isSmall` | `bool` | `false` | Decreases the size of the button.
`isToggled` | `bool` | `false` | Renders a toggled button style.
`isBusy` | `bool` | `false` | Indicates activity while a action is being performed.
`isLink` | `bool` | `false` | Renders a button with an anchor style.
`focus` | `bool` | `false` | Whether the button is focused.

## Related components

* To group buttons together, use the `ButtonGroup` component.
* To display an icon inside the button, use the `IconButton` component.

0 comments on commit 48e9e04

Please sign in to comment.