Skip to content

Instantly share code, notes, and snippets.

@Calvein
Created September 11, 2018 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Calvein/2aca3936ccc43d344d3927a9f55da786 to your computer and use it in GitHub Desktop.
Save Calvein/2aca3936ccc43d344d3927a9f55da786 to your computer and use it in GitHub Desktop.
Custom Dropdown react component API
<Dropdown
trigger={({ toggle }) => (
<Button
isDropdown
icon={<IconDecoration />}
iconActive={<IconDecorationFill />}
onClick={toggle}
>
Decoration
</Button>
)}
contentTitle="Decoration"
items={[(
<Button
key="door"
icon={<IconDoor />}
iconActive={<IconDoorFill />}
onClick={() => console.log('todo')}
>
Door
</Button>
), (
<Button
key="window"
icon={<IconWindow />}
iconActive={<IconWindowFill />}
onClick={() => console.log('todo')}
>
Door
</Button>
)]}
/>
<Dropdown
triggerText="Decoration"
triggerIcon={<IconDecoration />}
triggerIconActive={<IconDecorationFill />}
contentTitle="Decoration"
items={[{
id: 'door',
label: 'Door',
icon: <IconDoor />,
iconActive: <IconDoorFill />,
action: () => console.log('todo'),
}, {
id: 'window',
label: 'Window',
icon: <IconWindow />,
iconActive: <IconWindowFill />,
action: () => console.log('todo'),
}]}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment