| 1 |
import { Fragment, useState } from 'react'; |
| 2 |
import { Toolbar, ToolbarItem, ToolbarContent } from '@patternfly/react-core'; |
| 3 |
import { Button, SearchInput } from '@patternfly/react-core'; |
| 4 |
|
| 5 |
export const ToolbarItems = () => { |
| 6 |
const [searchValue, setSearchValue] = useState(''); |
| 7 |
|
| 8 |
const items = ( |
| 9 |
<Fragment> |
| 10 |
<ToolbarItem> |
| 11 |
<SearchInput |
| 12 |
aria-label="Items example search input" |
| 13 |
value={searchValue} |
| 14 |
onChange={(_event, value) => setSearchValue(value)} |
| 15 |
onClear={() => setSearchValue('')} |
| 16 |
/> |
| 17 |
</ToolbarItem> |
| 18 |
<ToolbarItem> |
| 19 |
<Button variant="secondary">Action</Button> |
| 20 |
</ToolbarItem> |
| 21 |
<ToolbarItem variant="separator" /> |
| 22 |
<ToolbarItem> |
| 23 |
<Button variant="primary">Action2</Button> |
| 24 |
</ToolbarItem> |
| 25 |
</Fragment> |
| 26 |
); |
| 27 |
|
| 28 |
return ( |
| 29 |
<Toolbar id="toolbar-items-example"> |
| 30 |
<ToolbarContent>{items}</ToolbarContent> |
| 31 |
</Toolbar> |
| 32 |
); |
| 33 |
}; |