Select
An accessible styled select built on Radix. The panel is positioned with plain CSS under the trigger, so it stays correct under a page zoom. Themed through class props; needs the .dbs-select rules from the library stylesheet.
npx shadcn@latest add https://ui.develop-better-solutions.com/r/select.jsonDependencies:
@radix-ui/react-selectlucide-reactSelected: week
Usage
select-example.tsx
"use client";
import { useState } from "react";
import { Select } from "@dbs/ui";
const PERIODS = [
{ value: "week", label: "This week" },
{ value: "month", label: "This month" },
{ value: "quarter", label: "This quarter" },
{ value: "year", label: "This year", disabled: true },
];
export default function SelectExample() {
const [value, setValue] = useState("week");
return (
<div className="flex w-full max-w-xs flex-col gap-3 text-sm">
<label htmlFor="select-demo" className="text-ink-muted">
Period
</label>
<Select id="select-demo" options={PERIODS} value={value} onValueChange={setValue} />
<p className="text-ink-subtle">Selected: {value}</p>
</div>
);
}