Render prop

Free · MIT

Lets Candor's Radix-based primitives also take Base UI's render prop.

Markdown

Preview

It's types and helpers, listed below.

Install

With the Candor CLI

First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/render-prop

Functions

withRender({ render, nativeButton: _nativeButton, ...props }: P & RenderProp)

Types

RenderProp
Lets Candor's Radix-based primitives also take Base UI's `render` prop. In projects on a Base UI style (shadcn's `base-*` styles), the shadcn CLI rewrites `<Trigger asChild><button/></Trigger>` into `<Trigger render={<button/>}>`; this turns that back into Radix's asChild, so Candor works in either kind of project.
{ /** Base UI's way to render as another element; the same as `asChild` with that element as the child. */ render?: React.ReactElement | undefined /** Base UI's flag for a button rendered as another element; shadcn adds it with `render`. Radix doesn't need it. */ nativeButton?: boolean | undefined }