Native Select

Styled wrapper around the native select element. Install Native Select from the VLLNT UI registry with the shadcn CLI.

Report a bug

Styled wrapper around the native select element. Part of the form family in VLLNT UI, it ships as a machine-readable registry entry — copy the source directly into your app with the shadcn CLI and own it, no runtime dependency on a component library.

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Installation

Add Native Select to your project with the shadcn CLI. The source lands in your codebase, ready to adapt:

pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/native-select.json

Source

import * as React from "react"; import { ChevronDown } from "lucide-react"; import { cn } from "../../lib/utils"; /** Styled wrapper around the native `select` element with a chevron. */ export type NativeSelectProps = React.ComponentPropsWithoutRef<"select"> & { rootClassName?: string; }; const NativeSelect = ({ children, className, ref, rootClassName, ...props }: NativeSelectProps & { ref?: React.Ref<HTMLSelectElement> }) => ( <div className={cn("relative w-full", rootClassName)}> <select {...props} className={cn( "h-10 w-full appearance-none rounded-md border border-input bg-background py-2 pl-3 pr-8 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className, )} ref={ref} > {children} </select> <ChevronDown className="pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 opacity-50" /> </div> ); NativeSelect.displayName = "NativeSelect"; export { NativeSelect };

Stories

Explore every variant and state in the interactive Storybook:

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Dependencies

  • @vllnt/ui@^0.3.0