ui
ui copied to clipboard
Recommend to add overflow css in Card Component
Card Title has a problem with overflow issue.
Example
const CardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn(
"text-2xl font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"
So I recommend to add overflow
and text-overflow
like this
const CardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn(
"text-2xl font-semibold leading-none tracking-tight overflow-hidden text-ellipsis",
className
)}
{...props}
/>
));
CardTitle.displayName = "CardTitle"
PR https://github.com/shadcn-ui/ui/pull/2593