-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update button docs * Update README.md
- Loading branch information
Showing
1 changed file
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |