Skip to content

Commit

Permalink
Adds basic documentation for the ToolbarButton component. (#23909)
Browse files Browse the repository at this point in the history
* Adds basic documentation for the ToolbarButton component.

* Updates compiled version of docs with ToolbarButton docs.

* Update packages/components/src/toolbar-button/README.md

Elaborates more on ToolbarComponent information, mentioning its accessibility features.

Co-authored-by: Daniel Richards <daniel.p.richards@gmail.com>

* Fixes typo 'control do select' on ToolbarButton documentation.

* Update packages/components/src/toolbar-button/README.md

Proper documentation links on ToolbarButton page.

Co-authored-by: Marcus Kazmierczak <marcus@mkaz.com>

* Update packages/components/src/toolbar-button/README.md

Proper links usage on ToolbarButton documentation page.

Co-authored-by: Marcus Kazmierczak <marcus@mkaz.com>

* Update packages/components/src/toolbar-button/README.md

Proper links usage on ToolbarButton documentation page.

Co-authored-by: Marcus Kazmierczak <marcus@mkaz.com>

* Update packages/components/src/toolbar-button/README.md

Proper links usage on ToolbarButton documentation page.

Co-authored-by: Marcus Kazmierczak <marcus@mkaz.com>

Co-authored-by: Daniel Richards <daniel.p.richards@gmail.com>
Co-authored-by: Marcus Kazmierczak <marcus@mkaz.com>
  • Loading branch information
3 people authored Jul 14, 2020
1 parent 87be0aa commit b13c198
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,12 @@
"markdown_source": "../packages/components/src/toggle-control/README.md",
"parent": "components"
},
{
"title": "ToolbarButton",
"slug": "toolbar-button",
"markdown_source": "../packages/components/src/toolbar-button/README.md",
"parent": "components"
},
{
"title": "Toolbar",
"slug": "toolbar",
Expand Down
26 changes: 26 additions & 0 deletions packages/components/src/toolbar-button/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ToolbarButton

A ToolbarButton can be used to add actions to your block control, usually inside a ToolbarGroup. It has similar features to the [Button](/packages/components/src/button/README.md) component. Using `ToolbarButton` will ensure the correct styling for a button in a toolbar, and also that keyboard interactions in a toolbar are consistent with the [WAI ARIA toolbar pattern](https://www.w3.org/TR/wai-aria-practices/#toolbar).

## Usage

```jsx
import { ToolbarButton } from "@wordpress/components";
import { edit } from "@wordpress/icons";

const MyToolbarButton = () => (
<MyToolbarButton
title="Edit"
icon={ edit }
onClick={ onEdit } />
);
```

## Props

This component accepts [the same API of the Button](/packages/components/src/button/README.md#props) component.

## Related components

* If you wish to implement a control to select options grouped as icon buttons you can use the [Toolbar](/packages/components/src/toolbar/README.md) component, which already handles this strategy.
* The ToolbarButton may be used with other elements such as [Dropdown](/packages/components/src/dropdown/README.md) to display options in a popover.

0 comments on commit b13c198

Please sign in to comment.