Skip to content

Commit

Permalink
feat(select): add SelectValueClipper for clipping SelectValue cor…
Browse files Browse the repository at this point in the history
…rectly
  • Loading branch information
Lordfirespeed committed Sep 30, 2024
1 parent c897ce2 commit e9ea928
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/ui/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ const SelectGroup = SelectPrimitive.Group

const SelectValue = SelectPrimitive.Value

const SelectValueClipper = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"flex items-end gap-2 overflow-hidden [&>span]:truncate",
className
)}
{...props}
/>
))
SelectValueClipper.displayName = "SelectValueClipper"

const SelectTrigger = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
Expand Down

0 comments on commit e9ea928

Please sign in to comment.