Componentpickers2.07 KB gzipZero dependencies
Select
Custom dashed listbox dropdown with keyboard navigation.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add selectOr install the full npm package:
npm install bigbulluiUsage
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 helpersZero 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 />| Prop | Type | Description |
|---|---|---|
| options | SelectOption[] | Selectable options list. (Default: []) |
| value | string | Controlled value. |
| defaultValue | string | Initial value when uncontrolled. (Default: "") |
| onValueChange | (value: string) => void | Callback invoked on value change. |
| placeholder | string | Placeholder text shown when empty. (Default: "Select an option") |
| disabled | boolean | Disables interaction and applies disabled styling. (Default: false) |
| required | boolean | Marks the input as required for native form validation. (Default: false) |
| name | string | Form field name submitted during form serialization. |
| id | string | DOM element identifier for label association and testing. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |
| aria-label | string | Configures aria label. |
| aria-labelledby | string | Configures aria labelledby. |
| animated | boolean | Dual-mode: false renders instantly with no motion. Default true. |