ui icon indicating copy to clipboard operation
ui copied to clipboard

Recommend to add overflow css in Card Component

Open de24world opened this issue 1 year ago • 0 comments

Card Title has a problem with overflow issue. Example overflow error

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

de24world avatar Jan 27 '24 20:01 de24world