Componentpickers2.07 KB gzipZero dependencies

Select

Custom dashed listbox dropdown with keyboard navigation.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add select

Or install the full npm package:

npm install bigbullui

Usage

tsx9 lines
import { Select } from "@/components/ui/select"; <Select  options={[    { value: "a", label: "Option A" },    { value: "b", label: "Option B" },  ]}  placeholder="Select an option"/>

Source code

select.tsx + 5 helpers

Zero third-party dependencies (6 local files shown in tabs below).

tsxselect.tsx298 lines
"use client"; import * as React from "react";import { createPortal } from "react-dom";import { cn } from "./lib/utils";import { registerEscapeLayer } from "./lib/focus-trap";import { mergeRefs, useIsMounted } from "./lib/react-compat";import { useControllableState } from "./lib/use-controllable-state";import { useFloating } from "./lib/floating"; export interface SelectOption {  value: string;  label: string;  disabled?: boolean;} export interface SelectProps {  options?: SelectOption[];

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { Select } from "@/components/ui/select"; <Select />
PropTypeDescription
optionsSelectOption[]Selectable options list. (Default: [])
valuestringControlled value.
defaultValuestringInitial value when uncontrolled. (Default: "")
onValueChange(value: string) => voidCallback invoked on value change.
placeholderstringPlaceholder text shown when empty. (Default: "Select an option")
disabledbooleanDisables interaction and applies disabled styling. (Default: false)
requiredbooleanMarks the input as required for native form validation. (Default: false)
namestringForm field name submitted during form serialization.
idstringDOM element identifier for label association and testing.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.
aria-labelstringConfigures aria label.
aria-labelledbystringConfigures aria labelledby.
animatedbooleanDual-mode: false renders instantly with no motion. Default true.