Free and open-source React dropdown components built for modern applications and websites. These dropdowns are built using React Aria and styled with Tailwind CSS.
Installation
You can add this dropdown component using our CLI or manually:
npx untitledui@latest add dropdown
Dropdown examples
Below are examples and variations of this dropdown component:
API reference
Import the parts and assemble them:
import { Dropdown } from "@/components/base/dropdown/dropdown"; <Dropdown.DotsButton /> <Dropdown.Popover> <Dropdown.Menu> <Dropdown.Item /> <Dropdown.Item /> <Dropdown.Separator /> <Dropdown.Item /> </Dropdown.Menu> </Dropdown.Popover>
Dropdown.Item
Renders React Aria’s MenuItem — all of its props are supported.
Props from React Aria (31)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
Dropdown.Popover
Renders React Aria’s Popover — all of its props are supported.
Styling (5)
Accessibility (4)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
Dropdown.Root
Renders React Aria’s MenuTrigger — all of its props are supported.
Dropdown.Section
Renders React Aria’s MenuSection — all of its props are supported.
Styling (3)
Accessibility (1)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
Dropdown.SectionHeader
Renders React Aria’s Header — all of its props are supported.
Styling (1)
Also accepts all standard HTML attributes, all aria-* attributes, all standard React DOM event handlers.
Dropdown.Separator
Renders React Aria’s Separator — all of its props are supported.
Styling (4)
Accessibility (4)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
FAQs
Please refer to our frequently asked questions page for more.
The first child of Dropdown.Root is the trigger and must be a React Aria pressable component, such as the Untitled UI Button or Dropdown.DotsButton, an icon-only button with a built-in "Open menu" label. The second child is the Dropdown.Popover that holds the Dropdown.Menu.
You can control the position of dropdowns using the placement prop on the Dropdown.Popover component. It accepts values like "top", "bottom", "left", "right", and their variations (e.g., "top start", "bottom right"). The default placement is "bottom right".
Yes. Dropdown.Item accepts a className, an icon component or an avatarUrl for the leading visual, an addon string for trailing text such as a keyboard shortcut, and unstyled to drop the built-in styles entirely.
Selection is off by default, because Dropdown.Menu forwards its props to React Aria's Menu, whose selectionMode defaults to "none". Set selectionMode to "single" or "multiple" on Dropdown.Menu or a Dropdown.Section, then pass selectedKeys (or defaultSelectedKeys) with onSelectionChange, which receives a Set of keys or the string "all". Selected items show a checkmark; set selectionIndicator on Dropdown.Item to "checkbox", "radio", "toggle" or "none" to change it.
You can organize dropdown items using Dropdown.Section components and separate them with Dropdown.Separator. You can also add section headers using Dropdown.SectionHeader to create well-organized dropdown menus.
Dropdown.Root is React Aria's MenuTrigger, so Enter, Space or Arrow Down on the focused trigger opens the menu at the first item, and Arrow Up opens it at the last. Inside the menu the arrow keys move between items, Enter or Space activates the focused item, and Escape closes the menu.
Yes. Set isDisabled on a Dropdown.Item, or pass an array of item ids to disabledKeys on Dropdown.Menu. Disabled items are dimmed with opacity-50, show a not-allowed cursor and can't be selected.