Select

Select

Select component allows users to choose from a list of options.

Examples
API

The Select component is a compound component that consists of multiple parts.

Select

The root component that provides context for the select.

PropdescriptionTypeDefault
children

The select content (Trigger, Container, Options)

React.ReactNode

value

The controlled value of the select

string | string[]

undefined

defaultValue

The default value of the select (uncontrolled)

string | string[]

undefined

onChange

Callback when the selected value changes

(value: string) => void

undefined

open

Whether the select dropdown is open (controlled)

boolean

undefined

defaultOpen

Whether the select dropdown is open by default

boolean

false

onOpenChange

Callback when the open state changes

(open: boolean) => void

undefined

type

The selection mode of the select

'default' | 'radio' | 'checkbox'

'default'

typography

Typography style key from the theme

DevupThemeTypographyKeys

undefined

options

Shorthand for defining options without using compound components

{ label?: string; disabled?: boolean; value: string; showCheck?: boolean; onClick?: (value, e) => void }[]

undefined

colors

Custom color variables for the select

{
primary?: string

border?: string

inputBackground?: string

inputDisabledBackground?: string

inputDisabledText?: string

base10?: string

title?: string

selectDisabled?: string

primaryBg?: string

}

undefined

SelectTrigger

The button that triggers the dropdown to open/close.

PropdescriptionTypeDefault
children

The trigger content

React.ReactNode

asChild

Render as the child element instead of a Button

boolean

false

SelectContainer

The dropdown container that holds the options.

PropdescriptionTypeDefault
children

The container content (Options)

React.ReactNode

showConfirmButton

Whether to show a confirm button (for checkbox type)

boolean

false

confirmButtonText

Text for the confirm button

string

'D�'

x

Horizontal offset for the dropdown position

number

0

y

Vertical offset for the dropdown position

number

0

SelectOption

An individual option within the select dropdown.

PropdescriptionTypeDefault
children

The option content

React.ReactNode

value

The value of the option

string

undefined

disabled

Whether the option is disabled

boolean

false

showCheck

Whether to show a check icon when selected

boolean

true

onClick

Custom click handler for the option

(value: string | undefined, e?: React.MouseEvent) => void

undefined

SelectDivider

A visual divider between options.