Skip to content

How can I extends the props of a component? #51

@JuaniSilva

Description

@JuaniSilva

Im trying to extends the props of the accordion component and I'm having some truble getting it done.

For example I would like to have a prop where I can pass a boolean to define where the accordion has borders or not. Something like this

const AccordionItem = React.forwardRef<
	React.ElementRef<typeof AccordionPrimitive.Item>,
	React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
>(({ className, ...props }, ref) => (
	<AccordionPrimitive.Item
		ref={ref}
		className={classNames(
			props.hasBorder ? "border-b border-b-slate-200" : "",
			className
		)}
		{...props}
	/>
));

But I've been trying to extend the props but I having trubble finding a way to do that. Any help?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions