How to write a component like radix? #1947
-
Sorry to ask this stupid question. I'm new to Reactjs and I was using Vue most of time. I really want to write a component like Radix. For example I want to use my component like this.
How can I write |
Beta Was this translation helpful? Give feedback.
Answered by
benoitgrelard
Feb 10, 2023
Replies: 1 comment 5 replies
-
There are a few ways of doing this compound component pattern:
Take a look at this example: primitives/packages/react/avatar/src/Avatar.tsx Lines 149 to 163 in 6ad72cb |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
lsy0xcc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are a few ways of doing this compound component pattern:
import * as …
pattern (we also export them named, but that's kinda irrelevant here)Take a look at this example:
primitives/packages/react/avatar/src/Avatar.tsx
Lines 149 to 163 in 6ad72cb