1. framework components
  2. combobox

Combobox

A combobox is an input widget with an associated popup that enables users to select a value from a collection of possible values.

Groups

Organize items into categorized groups.

Auto Highlight

Search for any option, then tap Enter on your keyboard to automatically select it.

Multiple

To maintain filtering functionality and improve clarity for users, we recommend displaying each selected value outside the perimeter of the Combobox component.

Disabled Item

Custom Filter

Try mistyping apple or banana to see the custom filter using the fuzzy search from Fuse.js in action.

Direction

Set the text direction (ltr or rtl) using the dir prop.

Guidelines

Z-Index

By default we do not take an opinionated stance regarding z-index stacking. The result is the component can sometimes be occluded beneath other elements with a higher index. The Z-Index can controlled by applying a utility class to the Content component part.

tsx
<Combobox.Content className="z-50" />

Max Items

We recommend no more than 500 items max. For normal usage, a few dozen will provide the best performance.

Anatomy

Here’s an overview of how the Combobox component is structured in code:

tsx
import { Combobox, Portal } from '@skeletonlabs/skeleton-react';

export default function Anatomy() {
	return (
		<Combobox>
			<Combobox.Label />
			<Combobox.Control>
				<Combobox.Input />
				<Combobox.Trigger />
				<Combobox.ClearTrigger />
			</Combobox.Control>
			<Portal>
				<Combobox.Positioner>
					<Combobox.Content>
						<Combobox.ItemGroup>
							<Combobox.ItemGroupLabel />
							<Combobox.Item>
								<Combobox.ItemText />
								<Combobox.ItemIndicator />
							</Combobox.Item>
						</Combobox.ItemGroup>
					</Combobox.Content>
				</Combobox.Positioner>
			</Portal>
		</Combobox>
	);
}

API Reference

Unable to load component information for react/combobox

View page on GitHub