Components
Loading preview...
Native select in shadcn/ui style
npx shadcn@latest add https://21st.dev/r/originui/select-nativeimport { SelectNative } from "@/components/ui/select-native";
import { useId } from "react";
function Component() {
const id = useId();
return (
<div className="relative min-w-[300px] rounded-lg border border-input bg-background shadow-sm shadow-black/5 transition-shadow focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/20 has-[select:disabled]:cursor-not-allowed has-[select:disabled]:opacity-50 [&:has(select:is(:disabled))_*]:pointer-events-none">
<label htmlFor={id} className="block px-3 pt-2 text-xs font-medium text-foreground">
Select with inset label (native)
</label>
<SelectNative
id={id}
defaultValue=""
className="border-none bg-transparent shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"
>
<option value="" disabled>
Select framework
</option>
<option value="1">React</option>
<option value="2">Next.js</option>
<option value="3">Astro</option>
<option value="4">Gatsby</option>
</SelectNative>
</div>
);
}
export { Component };