Native Select
octane/native-selectFreeComponent
octane publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by octane on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://raw.githubusercontent.com/octanejs/octane/main/packages/shadcn/registry/native-select.jsonSource
1// Base UI base native-select — a real `<select>`, so no headless primitive in any base.2//3// UNVERIFIED PROVENANCE: derived from this package's React Aria base rather than transcribed4// from upstream's `bases/base-ui/ui/native-select.tsx`, which was not available at port time.5// Diff the class strings against the upstream source before treating this as ported.6//7// OCTANE DIVERGENCE: upstream's IconPlaceholder resolves to lucide via @octanejs/lucide.8// Events are native: a `<select>`'s `change` keeps its platform commit meaning, so consumer9// `onChange` handlers are passed through unrenamed.10import { ChevronDownIcon } from '@octanejs/lucide';1112import { cn } from '@/lib/utils';13import type { HostProps } from '@/lib/types';1415export type NativeSelectProps =16 Omit<HostProps<'select'>, 'size'> & {17 size?: 'sm' | 'default';18 };1920export function NativeSelect({ className, size = 'default', ...props }: NativeSelectProps) @{21 <div22 className={cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', className)}23 data-slot="native-select-wrapper"24 data-size={size}25 >26 <select27 data-slot="native-select"28 data-size={size}29 className="h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"30 {...props}31 />32 <ChevronDownIcon33 className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"34 aria-hidden="true"35 data-slot="native-select-icon"36 />37 </div>38}3940export function NativeSelectOption({ className, ...props }: HostProps<'option'>) @{41 <option42 data-slot="native-select-option"43 className={cn('bg-[Canvas] text-[CanvasText]', className)}44 {...props}45 />46}4748export function NativeSelectOptGroup({ className, ...props }: HostProps<'optgroup'>) @{49 <optgroup50 data-slot="native-select-optgroup"51 className={cn('bg-[Canvas] text-[CanvasText]', className)}52 {...props}53 />54}
What it pulls in
npm packages
Other registry items
Files it writes
More from octane
All 44 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | octane | Components | Free | 2 deps | |
| Alertalert | octane | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | octane | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | octane | Components | Free | no deps | |
| Avataravatar | octane | Components | Free | 1 dep | |
| Badgebadge | octane | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | octane | Components | Free | 1 dep | |
| Buttonbutton | octane | Components | Free | 2 deps |
