23 lines
913 B
TypeScript
23 lines
913 B
TypeScript
import { forwardRef, type SelectHTMLAttributes } from 'react'
|
|
import { cn } from '@/lib/cn'
|
|
import { ChevronDown } from 'lucide-react'
|
|
|
|
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {}
|
|
|
|
export const Select = forwardRef<HTMLSelectElement, SelectProps>(({ className, children, ...props }, ref) => (
|
|
<div className="relative">
|
|
<select
|
|
ref={ref}
|
|
className={cn(
|
|
'flex h-9 w-full appearance-none rounded-md border border-input bg-transparent px-3 py-1 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',
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</select>
|
|
<ChevronDown className="pointer-events-none absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
|
</div>
|
|
))
|
|
Select.displayName = 'Select'
|