Dropdown menu
A button that opens a list of actions.
A button that opens a list of actions.
npm install @heroui/react
First time with HeroUI? Set it up once.
/**
* Demo from HeroUI, https://heroui.com (docs example dropdown/default.tsx).
* Apache-2.0, Copyright 2025 NextUI Inc. Full text: https://github.com/heroui-inc/heroui/blob/main/LICENSE
* Changed for Tastebud: a default export (HeroUI's docs use named ones).
*/
"use client";
import {Button, Dropdown, Label} from "@heroui/react";
export default function DropdownDemo() {
return (
<Dropdown>
<Button aria-label="Menu" variant="secondary">
Actions
</Button>
<Dropdown.Popover>
<Dropdown.Menu onAction={(key) => console.log(`Selected: ${key}`)}>
<Dropdown.Item id="new-file" textValue="New file">
<Label>New file</Label>
</Dropdown.Item>
<Dropdown.Item id="copy-link" textValue="Copy link">
<Label>Copy link</Label>
</Dropdown.Item>
<Dropdown.Item id="edit-file" textValue="Edit file">
<Label>Edit file</Label>
</Dropdown.Item>
<Dropdown.Item id="delete-file" textValue="Delete file" variant="danger">
<Label>Delete file</Label>
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown.Popover>
</Dropdown>
);
}
Changed for this site: A default export (HeroUI's docs use named ones).