Select

Field control for single or multi choice: label, hint, sizes, disabled, and value display.

Installation

Add this item from the registry, or import it from the package after installing Default File UI.

Registry path

itsvigneshv/default-file-ui/select

Package import

import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SelectField, SelectFieldLabel, SelectFieldHint, SelectFieldHelp, SelectValueSummary, SelectValueBadge } from "@default-file/ui/components/df-select"

Default

Pre-select state: placeholder in the trigger until a value is chosen.

Label and hint

Each piece is optional: toggle label, required mark, help, and hint independently.

This is a hint text to help user.

Disabled

Non-interactive field. With outside label and hint, or trigger only.

This field is currently unavailable.

Fixed width

Constrain the trigger width; the selected label truncates. The open list still sizes to its options.

Sizes

Small, medium, and large trigger heights.

Multi-select summary

Selected state as plain text: count plus supporting detail (for example user totals).

Multi-select badges

Selected people as high-contrast removable badges. Fixed width wraps chips onto new lines; the menu matches the field width.

Left anchor

Menu left edge lines up with the trigger. Use when the list is wider than the control.

Centre anchor

Menu is centered on the trigger.

Right anchor

Menu right edge lines up with the trigger.

Content-aware

Picks left, centre, or right, and flips above or below, based on available space.

Properties

Select composes Option List for the open panel. Configure the root, field chrome, trigger, value display, content, and items below.

Select

Root state for single or multi choice, open state, and disabled.

PropTypeDefaultNotes
selectionMode"single" | "multiple""single"Single value or multiple values.
valuestring | nullControlled value in single mode.
defaultValuestring | nullnullUncontrolled initial value in single mode.
onValueChange(value: string | null) => voidCalled when the single value changes.
valuesstring[]Controlled values in multiple mode.
defaultValuesstring[]Uncontrolled initial values in multiple mode.
onValuesChange(values: string[]) => voidCalled when multiple values change.
openbooleanControlled open state for the option list.
defaultOpenbooleanfalseUncontrolled initial open state.
onOpenChange(open: boolean) => voidCalled when the panel opens or closes.
closeOnSelectbooleanClose after choosing a row. Defaults to true in single mode, false in multiple.
disabledbooleanfalseNon-interactive field; keeps the menu closed.

SelectField

Optional outside label and hint. Omit any prop to hide that piece.

PropTypeDefaultNotes
labelReactNodeLabel above the control. Omit to hide the label row.
requiredbooleanShows the required mark on the label.
helpReactNodeHelp control after the label (for example SelectFieldHelp inside a Tooltip).
hintReactNodeSupporting text below the control. Omit to hide.
htmlForstringAssociates the label with the trigger id.
hintIdstringId for the hint; pair with aria-describedby on the trigger.
classNamestringLayout width and spacing for the field shell.

SelectTrigger

Combobox host for the visible control. Sizes, width, radius, and truncation are configured here.

PropTypeDefaultNotes
size"sm" | "md" | "lg" | "default""md"T-shirt height and type size. "default" is an alias for "md".
disabledbooleanOverrides Select disabled when set on the trigger.
classNamestringWidth and shape. Examples: w-64 (fixed width), w-36 (truncate), rounded-xl / rounded-full (radius override). Default radius uses the kit --radius-4xl token.
idstringFor label association and accessibility.
aria-describedbystringPoint at SelectField hintId when a hint is shown.

SelectValue

Shows the placeholder, selected label, or a custom render (summary / badges).

PropTypeDefaultNotes
placeholderstringPre-select copy when no value is chosen.
childrenReactNode | ((ctx) => ReactNode)Static content or a render function with selectionMode, value, values, labelFor, and toggleValue.
classNamestringValue text styles. Truncation follows a fixed-width trigger.

SelectValueSummary & SelectValueBadge

Multi-select value displays used inside SelectValue.

PropTypeDefaultNotes
SelectValueSummary.countnumberPrimary count text, for example “2 selected”.
SelectValueSummary.supportingTextReactNodeMuted secondary detail, for example “16 users”.
SelectValueBadge.valuestringSelected option value; remove toggles this value off.
SelectValueBadge.childrenReactNodeBadge label. Defaults to the registered option label.
SelectValueBadge.onRemove(value: string) => voidOptional custom remove handler instead of toggleValue.

SelectContent

Open Option List panel. Same API as OptionListContent.

PropTypeDefaultNotes
align"start" | "center" | "end" | "auto""start"Horizontal anchor relative to the trigger. auto picks the best fit.
alignItemWithTriggerbooleanfalseWhen true, menu width matches the trigger. When false, the menu hugs option content (and stays at least as wide as the trigger).
side"top" | "bottom" | "left" | "right""bottom"Preferred placement side.
sideOffsetnumber4Gap between trigger and panel.
alignOffsetnumber0Shift along the alignment axis.
portalbooleantrueRender in a portal. Set false for inline previews.
searchbooleanfalseShow a search field above the options.
searchPlaceholderstring"Search"Placeholder for the search field.
searchValuestringControlled search query.
defaultSearchValuestringUncontrolled initial search query.
onSearchChange(value: string) => voidCalled when the search query changes.
scrollablebooleanfalseWrap options in a scroll area.
scrollMaxHeightstring | number"16rem"Max height of the scrollable body.
footerReactNodeFooter actions under the options (for example Reset).
classNamestringPanel surface styles.

SelectItem

Option row. Same API as OptionListItem, including trailing badges and nested chevrons.

PropTypeDefaultNotes
valuestringOption value stored in Select state.
disabledbooleanNon-selectable row.
leading"checkbox" | "check" | ReactNode | falseLeading control. Use "checkbox" for multi-select rows.
secondaryReactNodeSupporting copy beside or under the label.
layout"inline" | "stacked""inline"inline places secondary beside the label; stacked places it underneath.
trailingReactNodeEnd-of-row slot: badge counter, nested-menu chevron, or both. When set, the selected check is hidden unless indicator is forced on.
indicatorbooleanSelected check in single mode. Defaults off when leading is checkbox or trailing is set; otherwise on.
childrenReactNodePrimary label registered for SelectValue.
classNamestringAdditional row styles.
…div attributesHTMLAttributesNative div props. Use data-highlighted for hover/open parent rows in nested menus.

Layout & appearance

Common configurations that are not single named props — use className and tokens.

PropTypeDefaultNotes
RadiusCSS / className--radius-4xlTrigger uses the kit radius token. Override with className such as rounded-xl or rounded-full.
Fixed widthclassName on SelectTriggerSet an explicit width (for example w-64). Multi-select badges wrap to new lines and the trigger grows in height.
Text truncationclassName on SelectTriggerConstrain width (for example w-36). SelectValue ellipsizes the selected label; the open list still hugs options unless alignItemWithTrigger is true.
Hug contentalignItemWithTrigger={false}falseDefault menu sizing: width follows the longest option (nowrap rows).
Match trigger widthalignItemWithTriggerLock the menu to the trigger width. Useful for fixed-width multi-select fields.
CompositionpartsAlso available: SelectGroup, SelectLabel, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, SelectFieldLabel, SelectFieldHint, SelectFieldHelp.