Skip to content

Dropdown

The Dropdown component provides a flexible dropdown menu using the Popover API. The component consists of three parts:

  • Dropdown: The parent component that handles the popover functionality (requires no props)
  • DropdownTrigger: The button that opens/closes the dropdown. Accepts all Button props (color, style, size, modifier, etc.)
  • DropdownContent: The dropdown menu content with the following props:
    • as: The HTML element to render ('ul', 'ol', or 'div'). Defaults to 'ul'
    • placement: Where the dropdown appears relative to the trigger ('top', 'bottom', 'left', 'right'). Defaults to 'bottom'
    • alignment: How the dropdown aligns to the trigger ('start', 'center', 'end'). Defaults to 'center'

The as prop allows you to choose which HTML element renders the dropdown content. Use 'ul' for unordered lists (default), 'ol' for ordered lists, or 'div' for custom containers.

The DropdownTrigger accepts all Button props, allowing you to style the trigger button just like any other button.