Dropdown with multiple DropdownLists – Use multiple DropdownLists to group actions together. A DropdownList can contain a border to visually separating these lists.
// import { Button, Dropdown, DropdownList, DropdownListItem } from '@contentful/forma-36-react-components';
functionDropdownExample(){
const[isOpen, setOpen]= React.useState(false);
return(
<Dropdown
isOpen={isOpen}
onClose={()=>setOpen(false)}
toggleElement={
<Button
size="small"
buttonType="muted"
indicateDropdown
onClick={()=>setOpen(!isOpen)}
>
Trigger Dropdown with multiple DropdownLists
</Button>
}
>
<DropdownList>
<DropdownListItemonClick={()=>{}}>
Dropdown list item 1
</DropdownListItem>
<DropdownListItemonClick={()=>{}}>
Dropdown list item 2
</DropdownListItem>
</DropdownList>
<DropdownListborder="top">
<DropdownListItemonClick={()=>{}}>
Dropdown list item 1
</DropdownListItem>
<DropdownListItemonClick={()=>{}}>
Dropdown list item 2
</DropdownListItem>
</DropdownList>
</Dropdown>
);
}
Dropdown with links – DropdownListItems can also contain TextLinks. These are often used to highlight related actions to the content of the DropdownList.
// import { Button, Dropdown, DropdownList, DropdownListItem } from '@contentful/forma-36-react-components';
Dropdown with max height – DropdownLists can have a max height to limit the height of the dropdown and introduce scrolling. This should be used when dropdowns need to contain a lot of data.
// import { Button, Dropdown, DropdownList, DropdownListItem } from '@contentful/forma-36-react-components';