Native Select
A styled native HTML select element with consistent design system integration.
Installation
Complete the project setup first. The init command configures TypeScript, Vite, Tailwind CSS v4, and Preact compatibility.
CLI
Run init once using the installation guide, then add this component. The CLI copies the required source files and installs their exact dependencies with Bun.
bunx --bun github:LiasCode/shadcn-preact#main add native-selectAdd --dry-run to review the changes. Existing modified files are protected; use --overwrite only when you want to replace them.
Manual installation / degit (optional)
1. Install dependencies
bun add --exact cn@0.4.0 lucide-preact@1.55.0 preact@11.0.1 tw-animate-css@1.4.02. Copy the component with degit
Run this from your project root. It selects native-select.tsx, its local dependencies, and both licenses directly from the repository, then copies them into src/components/ui.
bunx degit@3.10.0 https://github.com/LiasCode/shadcn-preact#main ./.cache/shadcn-preact/native-select --files LICENSE.md,registry/ui/lib/utils.ts,registry/ui/native-select.tsx,registry/ui/primitives/LICENSE,registry/ui/primitives/internals/types.ts --force
mkdir -p ./src/components/ui
cp -R ./.cache/shadcn-preact/native-select/registry/ui/. ./src/components/ui/
cp ./.cache/shadcn-preact/native-select/LICENSE.md ./src/components/ui/LICENSE.mdThe temporary copy lives in .cache/shadcn-preact/native-select. Existing components stay in place; shared source files are updated from main.
Selected source files (4)
Usage
import {
NativeSelect,
NativeSelectOptGroup,
NativeSelectOption,
} from "./components/ui/native-select"<NativeSelect>
<NativeSelectOption value="">Select a fruit</NativeSelectOption>
<NativeSelectOption value="apple">Apple</NativeSelectOption>
<NativeSelectOption value="banana">Banana</NativeSelectOption>
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
<NativeSelectOption value="pineapple">Pineapple</NativeSelectOption>
</NativeSelect>Examples
Reference
See the official Native Select documentation for composition patterns and API details. This page uses the Preact port and examples from the pinned upstream revision.
Component source