Native Select
uiable/native-selectFreeComponent
Native Select component.
Live preview
live · rendered by the registry
Rendered by uiable on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://uiable.com/r/native-select.jsonSource
1import { ComponentProps } from "react";23import { cn } from "@/lib/utils";4import { ChevronDownIcon } from "lucide-react";56type NativeSelectProps = Omit<ComponentProps<"select">, "size"> & {7 size?: "sm" | "default";8};910function NativeSelect({11 className,12 size = "default",13 ...props14}: NativeSelectProps) {15 return (16 <div17 className={cn(18 "group/native-select relative w-fit has-[select:disabled]:opacity-50",19 className20 )}21 data-slot="native-select-wrapper"22 data-size={size}23 >24 <select25 data-slot="native-select"26 data-size={size}27 className="data-placeholder:text-[#bec8d0] appearance-none bg-input dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 flex w-fit items-center justify-between gap-1.5 rounded-lg border py-[.8rem] pr-3 pl-3 text-base whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:bg-secondary-200/10 disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 data-[size=sm]:rounded-[min(var(--radius),6px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:outline-none focus:border-primary dark:focus:border-primary border-border"28 {...props}29 />30 <ChevronDownIcon31 className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"32 aria-hidden="true"33 data-slot="native-select-icon"34 />35 </div>36 );37}3839function NativeSelectOption({ ...props }: ComponentProps<"option">) {40 return <option data-slot="native-select-option" {...props} />;41}4243function NativeSelectOptGroup({44 className,45 ...props46}: ComponentProps<"optgroup">) {47 return (48 <optgroup49 data-slot="native-select-optgroup"50 className={cn(className)}51 {...props}52 />53 );54}5556export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
What it pulls in
npm packages
Files it writes
More from uiable
All 712 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | uiable | Components | Free | 2 deps | |
| Alertalert | uiable | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | uiable | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | uiable | Components | Free | no deps | |
| Attachmentattachment | uiable | Components | Free | 2 deps | |
| Avataravatar | uiable | Components | Free | 1 dep | |
| Badgebadge | uiable | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | uiable | Components | Free | 2 deps |
