Skip to content

Extending components with tailwind-variants #3181

Closed Answered by dvzrd
dvzrd asked this question in Help
Discussion options

You must be logged in to vote

I figured it out - the issue was that Card is a slot component and there's a different pattern to passing extended styles to slot components. Here's how it should be done:

const Card = ({
  className,
  color,
  radius,
  shadow,
  size,
  fullWidth,
  isHoverable,
  isPressable,
  isBlurred,
  isDisabled,
  disableAnimation,
  ...props
}: CardProps) => {
  const { base } = cardStyles({
    color,
    radius,
    shadow,
    size,
    fullWidth,
    isHoverable,
    isPressable,
    isBlurred,
    isDisabled,
    disableAnimation,
  })

  return <UICard className={base({ className })} {...props} />
}

You can read this for more info: https://www.tailwind-variants.org/docs/composing-compon…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dvzrd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant