Skip to Content
✨ Just dropped my UI Library — still cooking up some magic! Stay tuned & maybe… hire me  or sponsor me 😉 
DocumentationSelect

Select

A dropdown component that allows users to choose one option from a list. Features smooth animations, grouped options, and full keyboard accessibility.

Install Dependencies

npx
quickcode-ui add Select

Default Usage

Default Select

Props

Select

PropTypeDefaultDescription
valuestringundefinedThe controlled value of the select
defaultValuestringundefinedThe default value when uncontrolled
onValueChange(value: string) => voidundefinedCallback fired when the value changes
disabledbooleanfalseWhether the select is disabled
classNamestringundefinedAdditional CSS classes for the container
childrenReact.ReactNoderequiredThe select trigger and content

SelectTrigger

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes for the trigger
childrenReact.ReactNoderequiredThe trigger content (usually SelectValue)

SelectValue

PropTypeDefaultDescription
placeholderstring"Select an option"Placeholder text when no value selected
classNamestringundefinedAdditional CSS classes for the value

SelectContent

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes for the dropdown
childrenReact.ReactNoderequiredThe select groups and items

SelectGroup

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes for the group
childrenReact.ReactNoderequiredThe group label and items

SelectLabel

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes for the label
childrenReact.ReactNoderequiredThe label text

SelectItem

PropTypeDefaultDescription
valuestringrequiredThe value of the select item
classNamestringundefinedAdditional CSS classes for the item
childrenReact.ReactNoderequiredThe item content

Features

  • Compound Components: Flexible composition with Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel, and SelectItem
  • Grouped Options: Organize items into logical groups with labels for better UX
  • Smooth Animations: Powered by Framer Motion for fluid open/close transitions
  • Keyboard Accessible: Full keyboard navigation and screen reader support
  • Controlled & Uncontrolled: Supports both controlled and uncontrolled usage patterns
  • Check Indicator: Selected items display a check mark for visual confirmation
  • Auto-close: Dropdown closes automatically when an item is selected
  • Custom Styling: Each component accepts className for complete customization
  • Dark Mode Ready: Built with CSS tokens for seamless theme switching

Usage Notes

The Select component uses a compound pattern for maximum flexibility. Use SelectGroup and SelectLabel to organize options into categories like continents, departments, or any logical grouping. The component automatically handles focus management, value tracking, and accessibility attributes. Perfect for country selectors, category filters, or any dropdown with organized options.

Last updated on