woocommerce/plugins/woocommerce-admin/client/components/dropdown-button/README.md

35 lines
832 B
Markdown
Raw Normal View History

2018-06-29 00:34:17 +00:00
Dropdown Button
====
2018-07-02 23:58:05 +00:00
A button useful for a launcher of a dropdown component. The button is 100% width of its container and displays single or multiple lines rendered as `<span/>` elments.
2018-06-29 00:34:17 +00:00
## How to use:
```jsx
import { Dropdown } from '@wordpress/components';
import DropdownButton from 'components/dropdown-button';
render: function() {
return (
<Dropdown
renderToggle={ ( { isOpen, onToggle } ) => (
<DropdownButton
onClick={ onToggle }
isOpen={ isOpen }
labels={ [ 'All Products Sold' ] }
/>
) }
renderContent={ () => (
<p>Dropdown content here</p>
) }
/>
);
}
```
## Props
* `labels`: An array of elements to be rendered as the content of the button
* `isOpen`: boolean describing if the dropdown in open or not
* `*`: All other props are passed to Gutenberg's `<Button />` component