Porting components
Every port below keeps the shadcn structure (same file name, same exported names, same class strings) and changes only what is React-specific.
Every port below keeps the shadcn structure (same file name, same exported names, same class strings) and changes only what is React-specific. The recipe, used by every component:
React.forwardRefis gone. A ShadowJS component is a plain function ofprops;props.refis a callback ref.classNamebecomesclass. Merge the component's classes with the caller's throughmergeElementProps: classes from both sources are kept,styleobjects merge, handlers all run (the caller's first), refs all fire.asChildbecomesas: a tag name or a component. The primitive renders it with the merged props....propsstays{...merged}or{...rest}. Never destructure props in the signature of a library component:splitPropskeeps reactivity (applications can rely on the compiler's forgiving reactivity; library code should not).- Radix parts become the same-named parts of
@shadow-js/primitives.