Skip to main content

Starwind UI v3.0 is now available! Migration guide

Installation

Usage

Action Menu

A common use case is a compact list of application actions. Each DropdownItem participates in the Runtime menu’s keyboard navigation and selection behavior.

Use DropdownItem for commands in the current interface and DropdownLinkItem for navigation. Link items render native anchors, accept normal anchor attributes, and participate in the same keyboard navigation and highlighting as action items.

Disabled link items omit their href and expose the same disabled state as other menu items. DropdownLinkItem keeps the menu open by default; set closeOnClick when navigation does not unload the current page and the menu should close immediately.

Hover Open

The dropdown can be configured to open on hover in addition to click.

Use DropdownSub, DropdownSubTrigger, and DropdownSubContent to nest secondary actions.

Shortcuts

Add DropdownShortcut to display keyboard hints alongside actions.

Placement Options

You can position the dropdown menu in different ways by customizing the side and align properties.

With Icons

You can add icons to dropdown items for better visual cues.

API Reference

Styled Component API

These props are added or materially changed by the installed styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Expand a prop to see named type definitions and framework-specific imports. Follow the Primitive and Runtime links for lower-level behavior props.

Dropdown Trigger

Inherits button attributes.

Contains the following additional props:

Prop Type Default Toggle details
asChild boolean false
Description
Merges the component behavior and props into its child element.
Classification
Primitive override
Primitive prop
menu.Trigger.asChild

Dropdown Item

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
inset boolean false
Description
Adds leading inset spacing for visual alignment.
Classification
Wrapper prop

Inherits a attributes.

Contains the following additional props:

Prop Type Default Toggle details
closeOnClick boolean false
Description
Closes the containing surface after the item is activated.
Classification
Wrapper prop
inset boolean false
Description
Adds leading inset spacing for visual alignment.
Classification
Wrapper prop

Dropdown Checkbox Item

Inherits div attributes. Omits `aria-checked` and `role`.

Contains the following additional props:

Prop Type Default Toggle details
closeOnClick boolean false
Description
Closes the containing surface after the item is activated.
Classification
Wrapper prop
indicatorClass string
Description
Adds classes to the generated selection indicator.
Classification
Wrapper prop
inset boolean false
Description
Adds leading inset spacing for visual alignment.
Classification
Wrapper prop
showIndicator boolean true
Description
Shows the generated selection indicator.
Classification
Wrapper prop

Dropdown Radio Item

Inherits div attributes. Omits `aria-checked` and `role`.

Contains the following additional props:

Prop Type Default Toggle details
closeOnClick boolean false
Description
Closes the containing surface after the item is activated.
Classification
Wrapper prop
indicatorClass string
Description
Adds classes to the generated selection indicator.
Classification
Wrapper prop
inset boolean false
Description
Adds leading inset spacing for visual alignment.
Classification
Wrapper prop
showIndicator boolean true
Description
Shows the generated selection indicator.
Classification
Wrapper prop
value Required string
Description
Controls or identifies the component value.
Classification
Wrapper prop

Dropdown Label

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
inset boolean false
Description
Adds leading inset spacing for visual alignment.
Classification
Wrapper prop

Dropdown Sub Trigger

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
inset boolean false
Description
Adds leading inset spacing for visual alignment.
Classification
Wrapper prop

Dropdown Sub Content

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
side "top" | "right" | "bottom" | "left" "right"
Description
Selects the preferred side for floating content.
Classification
Primitive override
Primitive prop
menu.Popup.side
sideOffset number 0
Description
Sets the distance in pixels between floating content and its anchor.
Classification
Primitive override
Primitive prop
menu.Popup.sideOffset

Primitive And Runtime API

Use these references when you need the lower-level behavior APIs behind Dropdown.

Primitive API

Runtime API

Menu primitive
createMenu from @starwind-ui/runtime/menu

Changelog

v3.1.1

  • Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly.

v3.1.0

  • Added DropdownLinkItem for native anchor navigation; replace legacy DropdownItem as="a" usage with this dedicated part.

v3.0.0

  • Rebuilt Dropdown on Starwind Runtime while preserving its styled API over the shared Menu behavior.
  • See the Menu Primitive for the underlying unstyled anatomy and behavior API.