NOCTA UI

Select

A flexible select component for choosing from a list of options with multiple sizes and dark mode support

Installation

Install the Select component using the nocta-ui CLI:

npx nocta-ui add select

Import the components you need:

import {
  Select,
  SelectTrigger,
  SelectContent,
  SelectItem,
  SelectValue,
} from '@/components/ui/select';

Examples

Default Select

Variants

Visual variants help represent error and success states alongside the default appearance.

Please select an option

Looks good!

Sizes

Three size options are available: sm, md, and lg. The default size is md.

Api Reference

Select

PropTypeDefaultDescription
valuestringControlled value
defaultValuestringDefault value for uncontrolled component
onValueChange(value: string) => voidCallback when value changes
disabledbooleanfalseDisable the select
size'sm' | 'md' | 'lg''md'Select size
variant'default' | 'error' | 'success''default'Visual variant
childrenReact.ReactNodeSelect content

SelectTrigger

PropTypeDefaultDescription
classNamestring''Additional CSS classes
size'sm' | 'md' | 'lg'Override size from context
variant'default' | 'error' | 'success'Override variant from context
childrenReact.ReactNodeTrigger content

SelectContent

PropTypeDefaultDescription
classNamestring''Additional CSS classes
portalbooleantrueRender the dropdown in a React portal
fixedbooleanfalseUse fixed positioning to avoid clipping
childrenReact.ReactNodeContent (SelectItems)

SelectItem

PropTypeDefaultDescription
valuestringItem value
disabledbooleanfalseDisable the item
classNamestring''Additional CSS classes
childrenReact.ReactNodeItem content

SelectValue

PropTypeDefaultDescription
placeholderstring'Select an option...'Placeholder text
classNamestring''Additional CSS classes

All components also accept their respective HTML element attributes.