Menu
A list of options that appears when a user interacts with a button.
A list of options that appears when a user interacts with a button.
import { Button, Menu, Text } from '@tacos-ui/react';
import {
ChevronRightIcon,
CreditCardIcon,
LogOutIcon,
MailIcon,
MessageSquareIcon,
PlusCircleIcon,
SettingsIcon,
UserIcon,
UserPlusIcon,
} from 'lucide-react';
import { HStack } from '@tacos-ui/styled-system/jsx';
export const Demo = (props: Menu.RootProps) => {
return (
<Menu.Root {...props}>
<Menu.Trigger asChild>
<Button size={props.size} variant="outline">
Open Menu
</Button>
</Menu.Trigger>
<Menu.Positioner>
<Menu.Content>
<Menu.ItemGroup>
<Menu.ItemGroupLabel>My Account</Menu.ItemGroupLabel>
<Menu.Separator />
<Menu.Item value="profile">
<HStack flex="1" gap="6" justify="space-between">
<HStack gap="2">
<UserIcon />
Profile
</HStack>
<Text as="span" color="fg.subtle" size="sm">
⇧⌘P
</Text>
</HStack>
</Menu.Item>
<Menu.Item value="billing">
<HStack gap="2">
<CreditCardIcon /> Billing
</HStack>
</Menu.Item>
<Menu.Item value="settings">
<HStack flex="1" gap="6" justify="space-between">
<HStack gap="2">
<SettingsIcon /> Settings
</HStack>
<Text as="span" color="fg.subtle" size="sm">
⌘,
</Text>
</HStack>
</Menu.Item>
<Menu.Root positioning={{ placement: 'right-start', gutter: -2 }} {...props}>
<Menu.TriggerItem justifyContent="space-between">
<HStack gap="2">
<UserPlusIcon />
Invite member
</HStack>
<ChevronRightIcon />
</Menu.TriggerItem>
<Menu.Positioner>
<Menu.Content>
<Menu.Item value="email">
<HStack gap="2">
<MailIcon /> Email
</HStack>
</Menu.Item>
<Menu.Item value="message">
<HStack gap="2">
<MessageSquareIcon /> Message
</HStack>
</Menu.Item>
<Menu.Separator />
<Menu.Item value="other">
<HStack gap="2">
<PlusCircleIcon />
More Options...
</HStack>
</Menu.Item>
</Menu.Content>
</Menu.Positioner>
</Menu.Root>
<Menu.Separator />
<Menu.Item value="logout">
<HStack gap="2">
<LogOutIcon />
Logout
</HStack>
</Menu.Item>
</Menu.ItemGroup>
</Menu.Content>
</Menu.Positioner>
</Menu.Root>
);
};