Select

Single-value dropdown with arrow-key navigation, typeahead, and subtle open/close animation.

Installation

npx @obi/ui add select

Preview

The framework your project uses.

This field is required.

Usage

'use client';

import { useState } from 'react';
import { Select } from '@/src/components/Select/Select';

const FRAMEWORKS = [
  { value: 'next',    label: 'Next.js'  },
  { value: 'remix',   label: 'Remix'    },
  { value: 'astro',   label: 'Astro'    },
  { value: 'sveltekit', label: 'SvelteKit' },
];

export default function Example() {
  const [value, setValue] = useState('');

  return (
    <Select
      label="Framework"
      placeholder="Choose a framework…"
      options={FRAMEWORKS}
      value={value}
      onChange={setValue}
      hint="The framework your project uses."
    />
  );
}

Props

NameTypeDefaultDescription
optionsSelectOption[]Array of { value, label } objects.
valuestringundefinedControlled selected value.
onChange(value: string) => voidundefinedCalled when a selection is made.
placeholderstring'Select…'Shown when no value is selected.
labelstringundefinedVisible label above the trigger.
hintstringundefinedHelper text (hidden when error is set).
errorstringundefinedError message; switches trigger to error state.
size'sm' | 'md''md'Trigger height and text size.
disabledbooleanfalsePrevents interaction.
classNamestring''Additional classes on the root wrapper.