@codecraftkit
Documentation
An accessible dropdown menu for the common dropdown menu button.
This component is based on Menu
it can be imported from the core.
import { Menu } from "@codecraftkit/core";
or alone.
import Menu from "@codecraftkit/menu";
It can be used in three different ways
You could also pass a React component throughout the body
<Menu label="Menu" body="Hello World" />
Using its children, and the close button
<Menu variant="ghost" label="Menu">Hello World, using its <Code>children</Code></Menu>
With menu items takes an array of items similar of how the navbar works, the items must contain a label and href, the href could be changed for route or action
Also you can group the items using the group key as shown below
function myApp(){const menuItems = [{route: '/alert',label: 'Alert'}, {group:'Group Links',items:[{route: '/data-table',label: 'DataTable'},{href: 'https://chakra-ui.com/',label: 'Chakra'},{action: () => alert('Hello'),label: 'Hello'}]},]return <Menu label="Menu" menuItems={menuItems} />}
label
String
yes
The button label
icon
Icon
Show the button as an icon
menuItems
Array<object>
no
It put the items as a list
body
String
React Component
no
The content of the menu
children
React Component
no
The content of the menu, but you can use the children prop
trigger
ReactComponent
no
Custom Trigger Component
variant
solid
link
outline
ghost
unstyled
no
solid
Button style variant
styles
styles<object>
no
Apply custom styles for the button