Dropdown

Stable
This component has limited functionality on the server side. In Next.js, add "use client" at the top to make it work.

A flexible dropdown menu component for displaying a list of actions or options.

Import

TypeScript React
import { Dropdown } from "laxod";

Basic Usage

The simplest dropdown with a button trigger and basic items.

Basic Dropdown

With Icons

Add icons to menu items for better visual clarity.

Dropdown with Icons

Destructive Actions

Mark dangerous actions with the destructive property for visual distinction.

Destructive Items

Disabled Items

Disable specific menu items to prevent interaction.

Disabled Items

Positioning

Control where the dropdown appears relative to the trigger.

Dropdown Positioning

Props

PropTypeDefaultDescription
itemsDropdownItem[]-Array of menu items to display
triggerReactNode-Element that opens the dropdown
onSelect(value: string) => void-Callback when an item is selected
align"start" | "center" | "end""start"Horizontal alignment of the dropdown
side"top" | "right" | "bottom" | "left""bottom"Side where the dropdown appears
sideOffsetnumber8Distance in pixels from the trigger
disabledbooleanfalseDisable the entire dropdown
classNamestring""Additional CSS classes for trigger
contentClassNamestring""Additional CSS classes for content
itemClassNamestring""Additional CSS classes for items
aria-labelstring-Accessibility label for the dropdown

DropdownItem Type

PropertyTypeRequiredDescription
labelstringYesDisplay text for the item
valuestringYesUnique identifier for the item
iconReactNodeNoIcon element to display
disabledbooleanNoDisable this specific item
destructivebooleanNoMark item as destructive action