Spaces:
Sleeping
Sleeping
File size: 968 Bytes
e0eaa09 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
'use client';
import { cn } from '@/utils/Helpers';
import { ChevronDown } from 'lucide-react';
import * as React from 'react';
import { SelectContext } from './SelectContext';
export default function SelectTrigger({ children, className }: { children: React.ReactNode; className?: string }) {
const context = React.useContext(SelectContext);
if (!context) {
throw new Error('SelectTrigger must be used within Select');
}
return (
<button
type="button"
onClick={() => context.setOpen(!context.open)}
className={cn(
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className,
)}
>
{children}
<ChevronDown className="size-4 opacity-50" />
</button>
);
}
|