Next.js Discord

Discord Forum

"Component inheritance"

Unanswered
Yellow and black potter wasp posted this in #help-forum
Open in Discord
Yellow and black potter waspOP
How do I inherit all of a component's properties and specify some predefined ones, for example here I want to inherit from shadcn's Button (https://ui.shadcn.com/docs/components/button) and default the text size to large
function Key({ children, className, ...props }: { children: React.ReactNode, className: string }) {
  return (
    <Button
      className={cn("text-lg", className)}
      variant="outline"
      {...props}
    >
      {children}
    </Button>
  )
}

but all the other props don't seem to be inherited

0 Replies