Skip to main content
PROYECTOVIVIANA

ListBox

The props declared for ListBox, generated from the types @proyecto-viviana/ui ships.

Import

import { ListBox } from "@proyecto-viviana/ui";

Props

Props for ListBox in @proyecto-viviana/ui
PropTypeDefaultDescription
size'sm' | 'md' | 'lg'—The size of the listbox.
classstring—Additional CSS class name.
labelstring—Label for the listbox.
descriptionstring—Description for the listbox.
children*(item: T) => JSX.Element—The children of the component. A function may be provided to render each item. solidaria-components
slotstring | false—A slot name for the component. HTML `slot` may be `false` to omit. solidaria-components
ref((el: HTMLDivElement) => void) | { current?: HTMLDivElement | null | undefined; }—Ref for the listbox element. solidaria-components
idstring—An ID for the listbox. solidaria
onBlur(e: FocusEvent) => void—Handler called when focus moves out of the listbox. solidaria
onFocus(e: FocusEvent) => void—Handler called when focus moves into the listbox. solidaria
onSelectionChange(keys: "all" | Set<Key>) => void—Handler called when selection changes. solidaria-components
aria-describedbystring—The ID of an element that describes the listbox. solidaria
aria-labelstring—An accessible label for the listbox when no visible label is provided. solidaria
aria-labelledbystring—The ID of an element that labels the listbox. solidaria
isDisabledfalse | true—Whether the listbox is disabled. solidaria
onFocusChange(isFocused: boolean) => void—Handler called when the focus state changes. solidaria
selectionMode'none' | 'single' | 'multiple'—The selection mode. solidaria-components
disallowEmptySelectionfalse | true—Whether Escape and other collection-level interactions may clear the selection. This is an ARIA behavior override and does not change whether an option press may toggle the final selected item. solidaria
selectedKeys"all" | Iterable<Key>—Currently selected keys (controlled). solidaria-components
defaultSelectedKeys"all" | Iterable<Key>—Default selected keys (uncontrolled). solidaria-components
orientation'horizontal' | 'vertical'—Orientation hint for styling parity. solidaria-components
items*CollectionEntry<T>[]—The items to render in the listbox. solidaria-components
onAction(key: Key) => void—Handler called when an item is activated (pressed). solidaria
shouldFocusWrapfalse | true—Whether focus should automatically wrap around. solidaria
disallowTypeAheadfalse | truefalseWhether type-to-select is disabled. solidaria
selectionBehavior'toggle' | 'replace'—The selection behavior (toggle vs replace). solidaria-components
getKey(item: T) => Key—Function to get the key from an item. solidaria-components
getTextValue(item: T) => string—Function to get the text value from an item. solidaria-components
getDisabled(item: T) => boolean—Function to check if an item is disabled. solidaria-components
disabledKeysIterable<Key>—Keys of disabled items. solidaria-components
disabledBehavior'all' | 'selection'—Whether disabled items can still receive focus. solidaria-components
renderEmptyState() => JSX.Element—A function to render when the listbox is empty. solidaria-components
dragAndDropHooksDragAndDropHooks<T>—Drag and drop hooks from `useDragAndDrop`. solidaria-components
isVirtualizedfalse | true—Whether the listbox uses virtual scrolling. solidaria
isLoadingfalse | true—Whether additional items are currently loading. solidaria-components
keyboardDelegateKeyboardDelegate—An optional keyboard delegate implementation for type to select, to override the default. solidaria
layoutDelegateLayoutDelegate—A delegate object that provides layout information for items in the collection. By default this uses the DOM, but this can be overridden to implement things like virtualized scrolling. solidaria
shouldSelectOnPressUpfalse | true—Whether selection should occur on press up. solidaria
direction'ltr' | 'rtl'"ltr"The text direction, used to resolve the horizontal navigation axis. In a horizontal listbox, RTL flips Left/Right (Right=previous, Left=next). solidaria
layout'grid' | 'stack'—Layout hint for styling parity. solidaria-components
hasMorefalse | true—Whether there are more items to load. solidaria-components
onLoadMore() => void | Promise<void>—Called when the load more sentinel becomes visible. solidaria-components
shouldFocusOnHoverfalse | true—Whether to focus items on hover. solidaria
shouldUseVirtualFocusfalse | true—Whether options should use virtual focus instead of receiving DOM focus. solidaria
slotsRecord<string, Partial<ListBoxProps<T>>>—Slot definitions provided through ListBoxContext. solidaria-components
linkBehavior'none' | 'selection' | 'action' | 'override'—The behavior of links in the collection. solidaria
UNSTABLE_itemBehavior'selection' | 'action'—Unstable upstream override that forces items with actions to prefer selection or action behavior. solidaria
shouldSelectOnFocusfalse | truetrueWhether keyboard focus movement should also update selection in single selection mode. solidaria
escapeKeyBehavior'none' | 'clearSelection'"clearSelection"Whether pressing the Escape key should clear selection in the listbox or not. Most experiences should not modify this option as it eliminates a keyboard user's ability to easily clear selection. Only use if the escape key is being handled externally or should not trigger selection clearing contextually. solidaria

Declared in packages/viviana-ui/src/listbox/index.tsx.

ListBoxOption props

Props for ListBoxOption in @proyecto-viviana/ui
PropTypeDefaultDescription
classstring—Additional CSS class name.
descriptionstring—Optional description text.
icon() => JSX.Element—Optional icon to display before the label. Use a function returning JSX for SSR compatibility: `icon={() => <MyIcon />}`
childrennumber | boolean | RenderedElement | ArrayElement | (string & {}) | Node | JSX.ArrayElement | ((renderProps: ListBoxOptionRenderProps) => JSX.Element)—The children of the option. A function may be provided to receive render props. solidaria-components
slotstring | false—A slot name for the component. HTML `slot` may be `false` to omit. solidaria-components
ref((el: HTMLDivElement) => void) | { current?: HTMLDivElement | null | undefined; }—Ref for the option element. solidaria-components
id*Key—The unique key for the option. solidaria-components
aria-labelstring—An accessible label for the option. solidaria
isDisabledfalse | true—Whether the option is disabled. solidaria
onHoverStart(e: HoverEvent) => void—Handler called when hover starts. solidaria
onHoverEnd(e: HoverEvent) => void—Handler called when hover ends. solidaria
onHoverChange(isHovering: boolean) => void—Handler called when hover state changes. solidaria
onAction() => void—Handler called when the option is activated. solidaria
isVirtualizedfalse | true—Whether the option is contained in a virtual scrolling listbox. solidaria
itemNonNullable<T>—The item value. solidaria-components
textValuestring—The text value of the option (for typeahead). solidaria-components
shouldSelectOnPressUpfalse | true—Whether selection should occur on press up. solidaria
optionIdstring—Optional DOM id for the option element. Defaults to the key. solidaria
shouldFocusOnHoverfalse | true—Whether to focus the option on hover. solidaria
shouldUseVirtualFocusfalse | true—Whether the option should use virtual focus instead of receiving DOM focus. solidaria
focus() => void—Function to focus the option, overriding the default DOM focus. Forwarded into `createSelectableItem` (`useSelectableItem` `focus`). solidaria
allowsDifferentPressOriginfalse | true—Whether press-up may occur without the press starting on this option. solidaria

Declared in packages/viviana-ui/src/listbox/index.tsx.

ListBoxSection props

Props for ListBoxSection in @proyecto-viviana/ui
PropTypeDefaultDescription
classstring—Additional CSS class name.
childrennumber | boolean | RenderedElement | ArrayElement | (string & {}) | Node | JSX.ArrayElement—Section contents, usually Header + Group/items. solidaria-components
slotstring | false—A slot name for the component. HTML `slot` may be `false` to omit. solidaria-components
ref((el: HTMLDivElement) => void) | { current?: HTMLDivElement | null | undefined; }—Ref for the section element. solidaria-components
idstring—DOM id forwarded to the section element. solidaria-components
aria-labelstring—Accessible name when the section has no naming header. solidaria-components
aria-labelledbystring—Id of the element that names the section. solidaria-components
rolefalse | 'group' | 'region' | 'none' | 'form' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | 'button' | 'alert' | 'alertdialog' | 'application' | 'article' | 'banner' | 'cell' | 'checkbox' | 'columnheader' | 'combobox' | 'complementary' | 'contentinfo' | 'definition' | 'directory' | 'document' | 'feed' | 'figure' | 'gridcell' | 'heading' | 'img' | 'link' | 'list' | 'listitem' | 'log' | 'main' | 'marquee' | 'math' | 'menubar' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'meter' | 'navigation' | 'note' | 'option' | 'presentation' | 'progressbar' | 'radio' | 'radiogroup' | 'row' | 'rowgroup' | 'rowheader' | 'scrollbar' | 'search' | 'searchbox' | 'separator' | 'slider' | 'spinbutton' | 'status' | 'switch' | 'tab' | 'table' | 'tablist' | 'tabpanel' | 'term' | 'textbox' | 'timer' | 'toolbar' | 'tooltip' | 'treegrid' | 'treeitem'—ARIA role forwarded to the section element. solidaria-components

Declared in packages/viviana-ui/src/listbox/index.tsx.

Props marked solidaria or solidaria-components come from the headless layer underneath and behave the same in both registers. Components that wrap a DOM element also accept that element's standard attributes, which are left out here on purpose — listing them would bury the props that are actually ours.