mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { ChevronDown } from "lucide-react";
|
|
import type * as React from "react";
|
|
|
|
export function FormSelect({
|
|
children,
|
|
disabled,
|
|
id,
|
|
onChange,
|
|
value,
|
|
}: {
|
|
children: React.ReactNode;
|
|
disabled?: boolean;
|
|
id?: string;
|
|
onChange: (value: string) => void;
|
|
value: string;
|
|
}) {
|
|
return (
|
|
<div className="relative">
|
|
<select
|
|
className="flex h-9 w-full appearance-none rounded-md border border-input bg-transparent px-3 pr-8 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
|
|
disabled={disabled}
|
|
id={id}
|
|
onChange={(event) => onChange(event.target.value)}
|
|
value={value}
|
|
>
|
|
{children}
|
|
</select>
|
|
<ChevronDown className="pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function FieldLabel({
|
|
children,
|
|
htmlFor,
|
|
}: {
|
|
children: React.ReactNode;
|
|
htmlFor?: string;
|
|
}) {
|
|
return (
|
|
<label
|
|
className="block text-xs font-medium text-muted-foreground"
|
|
htmlFor={htmlFor}
|
|
>
|
|
{children}
|
|
</label>
|
|
);
|
|
}
|