agentic-ui logoagentic-ui

Select

Dropdown select with keyboard navigation, grouping, and search. Use the high-level wrapper or compose individual styled parts with a raw base-ui Root.

High-level wrapper

import { Select } from "@brijbyte/agentic-ui/select";

import "@brijbyte/agentic-ui/select.css";

export default function HighLevelDemo() {
  return (
    <div style={{ width: 220 }}>
      <Select
        placeholder="Choose a framework…"
        options={[
          { value: "react", label: "React" },
          { value: "vue", label: "Vue" },
          { value: "svelte", label: "Svelte" },
          { value: "solid", label: "SolidJS" },
          { value: "angular", label: "Angular", disabled: true },
        ]}
      />
    </div>
  );
}

Composed: base-ui Root + styled parts

import { useState } from "react";
import { Select as BaseSelect } from "@base-ui/react/select";
import {
  SelectTrigger,
  SelectValue,
  SelectPositioner,
  SelectPopup,
  SelectList,
  SelectItem,
  SelectItemText,
  SelectItemIndicator,
  SelectGroupContainer,
  SelectGroupLabel,
  SelectSeparator,
} from "@brijbyte/agentic-ui/select";

import "@brijbyte/agentic-ui/select.css";

export default function ComposedDemo() {
  const [value, setValue] = useState<string | null>(null);

  return (
    <div style={{ width: 220 }}>
      <BaseSelect.Root value={value} onValueChange={setValue}>
        <SelectTrigger>
          <SelectValue placeholder="Choose a model…" />
        </SelectTrigger>
        <BaseSelect.Portal>
          <SelectPositioner sideOffset={4}>
            <SelectPopup>
              <SelectList>
                <SelectGroupContainer>
                  <SelectGroupLabel>Anthropic</SelectGroupLabel>
                  {["claude-opus", "claude-sonnet", "claude-haiku"].map((m) => (
                    <SelectItem key={m} value={m}>
                      <SelectItemText>{m}</SelectItemText>
                      <SelectItemIndicator />
                    </SelectItem>
                  ))}
                </SelectGroupContainer>
                <SelectSeparator />
                <SelectGroupContainer>
                  <SelectGroupLabel>OpenAI</SelectGroupLabel>
                  {["gpt-4o", "gpt-4o-mini"].map((m) => (
                    <SelectItem key={m} value={m}>
                      <SelectItemText>{m}</SelectItemText>
                      <SelectItemIndicator />
                    </SelectItem>
                  ))}
                </SelectGroupContainer>
              </SelectList>
            </SelectPopup>
          </SelectPositioner>
        </BaseSelect.Portal>
      </BaseSelect.Root>
    </div>
  );
}

API Reference

Dropdown select with keyboard navigation, grouping, and search. Pass
options for a flat list or groups for sections with optional labels.

PropTypeDefault
valuestring

Currently selected value (controlled).

defaultValuestring

Initially selected value (uncontrolled).

onValueChange((value: string | null, eventDetails: unknown) => void)

Called when the selection changes. eventDetails is the base-ui event details object. Value may be null when cleared.

disabledboolean

Prevent interaction.

requiredboolean

Mark the field as required for form validation.

namestring

HTML name attribute for form submission.

placeholderstringSelect…

Text shown when no value is selected.

optionsSelectOption[]

Flat list of options (use groups for grouped options).

groupsSelectGroup[]

Grouped options with optional section labels.

classNamestring
idstring

Override the auto-generated element id.

Styled Parts

base-ui docs ↗

Pre-styled wrappers around the corresponding base-ui parts. All base-ui props are forwarded.

CSS Class Names

Available as keys on the SelectStyles object. Each key maps to a hashed CSS module class name at runtime.

group-labelitemitem-indicatorlistpopuppositionerseparatortriggertrigger-icontrigger-value