Option List

Open panel and option rows: search, checkboxes, secondary text, scroll, and footer actions.

Installation

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

Registry path

itsvigneshv/default-file-ui/option-list

Package import

import { OptionList, OptionListContent, OptionListItem, OptionListSubmenu, OptionListSubContent } from "@default-file/ui/components/df-option-list"

Panel

The open list surface. Item rows are documented separately below.

Item states

List item alone: default, hover, selected (active), and disabled.

Item content

Leading checkbox, primary label, and muted secondary text across states.

Stacked description

Heading on top, description underneath. The whole block is one selectable option.

Stacked with checkbox

Same stacked layout with a leading checkbox for multi-select.

Trailing badge counter

Number counter at the end of the row via the trailing slot.

Nested menu

Hover a parent row to open the next level. Badge plus chevron marks nested parents; leave the branch to close it.

Groups and separators

Section labels and dividers inside the panel.

Search, scroll, and actions

Full panel chrome: search, scrollable body, and footer actions.

Properties

Open panel and option rows for pickers. Select composes this list for its menu.

OptionList

Root selection and open state.

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.
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.
submenuAnimatedbooleantrueDefault motion for all nested OptionListSubmenu panels. true plays open/close animations; false makes nested menus appear and disappear instantly. Overridden by OptionListSubmenu or OptionListSubContent animated.
submenuOpenDurationnumber180Default open animation duration in milliseconds for nested submenus. Ignored when submenuAnimated is false. Overridden by OptionListSubmenu or OptionListSubContent openDuration.
submenuCloseDurationnumber90Default close animation duration in milliseconds for nested submenus. Ignored when submenuAnimated is false. Overridden by OptionListSubmenu or OptionListSubContent closeDuration.

OptionListTrigger

Opens and closes the option list. Use render to compose onto Badge or another host.

PropTypeDefaultNotes
renderReactElementHost element to clone trigger behavior onto (for example Badge). Owns click, keyboard, and anchor ref.
childrenReactNodeTrigger content (label, chevron, etc.).
classNamestringAdditional styles.
…button attributesButtonHTMLAttributesNative button props when not using render.

OptionListContent

Portaled or inline panel with optional search, scroll, and footer.

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.

OptionListItem

Selectable row with leading control, secondary copy, trailing badge or chevron, and selection indicator. Inside OptionListSubmenu (trigger zone) it opens the submenu on hover instead of selecting.

PropTypeDefaultNotes
valuestringOption value stored in selection 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 text for the row.
classNamestringAdditional row styles.
…div attributesHTMLAttributesNative div props. Use data-highlighted for hover/open parent rows in nested menus.

OptionListSubmenu

Hover-open nested branch. Wrap a trigger OptionListItem and an OptionListSubContent. Nest again inside the content for deeper levels. Motion defaults inherit from OptionList and can be overridden here.

PropTypeDefaultNotes
openbooleanControlled submenu open state.
defaultOpenbooleanfalseUncontrolled initial open state (useful for docs previews).
onOpenChange(open: boolean) => voidCalled when the submenu opens or closes.
animatedbooleaninherits OptionList.submenuAnimated (true)true plays fade/slide open and close for this branch. false opens and closes instantly with no motion. Prefer OptionList submenuAnimated=false to turn off motion for every nested level at once.
openDurationnumberinherits OptionList.submenuOpenDuration (180)Open animation duration in milliseconds for this branch. Only applies when animated is true.
closeDurationnumberinherits OptionList.submenuCloseDuration (90)Close animation duration in milliseconds for this branch. Only applies when animated is true. Keep this shorter than openDuration for a snappy dismiss.
closeDelaynumber60Milliseconds to wait after the pointer leaves the branch before starting close. Gives time to move into the child panel. Exit animation (if animated) starts after this delay.
childrenReactNodeTrigger OptionListItem plus OptionListSubContent (and nested submenus).

OptionListSubContent

Child panel for a submenu. Opens on hover of the parent row; nest further OptionListSubmenu trees inside. Placement and motion can be set per panel.

PropTypeDefaultNotes
side"top" | "bottom" | "left" | "right""right"Preferred placement relative to the parent row.
sideOffsetnumber4Gap between the parent row and the child panel.
align"start" | "center" | "end" | "auto""start"Alignment along the parent row.
alignOffsetnumber0Shift along the alignment axis.
portalbooleantrueRender in a portal. Set false for inline nested previews in docs.
animatedbooleaninherits OptionListSubmenu.animatedPer-panel motion override. false makes this panel appear and disappear instantly even if parent submenus are animated.
openDurationnumberinherits OptionListSubmenu.openDurationPer-panel open duration in milliseconds. Ignored when animated is false.
closeDurationnumberinherits OptionListSubmenu.closeDurationPer-panel close duration in milliseconds. Ignored when animated is false.
classNamestringPanel surface styles.
childrenReactNodeOption rows and nested OptionListSubmenu branches.

OptionListBody

Scrollable or static body wrapping option rows.

PropTypeDefaultNotes
scrollablebooleanfalseWrap children in ScrollArea.
maxHeightstring | number"16rem"Height constraint when scrollable.
childrenReactNodeOption rows.

Grouping parts

PropTypeDefaultNotes
OptionListGroupdiv attrsGroups related items.
OptionListLabeldiv attrsMuted group heading inside the panel.
OptionListSeparatorseparatorHorizontal rule between sections.
OptionListScrollUpButton / ScrollDownButtonbuttonOptional scroll affordances for long lists.
useOptionListContext() => contextRead open state, selection, labels, and search from parts.

Layout & appearance

PropTypeDefaultNotes
Hug contentalignItemWithTrigger={false}falsePanel width follows option content; at least trigger width.
Match trigger widthalignItemWithTriggerLock panel width to the trigger.
Inline previewsportal={false}Render the panel in place for docs and nested layouts.
Trailing badge countertrailing={<Badge>…</Badge>}Number badge at the end of the row. Right padding matches checkbox rows; selected check stays hidden.
Nested submenu rowOptionListSubmenu + SubContentHover the parent row to open the child panel on the right. Nest Submenu trees for three or more levels. Use trailing for badge + ChevronRight. Control motion with submenuAnimated / animated (boolean) and submenuOpenDuration / submenuCloseDuration or openDuration / closeDuration (ms).
Instant nested menussubmenuAnimated={false}Disable open/close animation for every nested level from OptionList. Equivalent per-branch: OptionListSubmenu animated={false}.
Custom nested speedsubmenuOpenDuration / submenuCloseDurationSet open and close durations in milliseconds on OptionList (defaults 180 / 90). Override on a single Submenu or SubContent when one branch should feel different.
Item spacingCSSRows use kit gap and hover/selected/disabled states via data attributes.