Docs
cn

cn

API reference for @udecode/cn.

@udecode/cn contains utility functions for React & Tailwind.

cn

Conditionally add Tailwind CSS classes without conflicts.

Parameters

Collapse all

    Class values set using clsx and tailwind-merge.

Returns

    className string.

withCn

Set default className to a component.

Parameters

Collapse all

    The component to which props will be added.

    The default className to set using cn.

Returns

    A new component that includes the default className.

withProps

Set default props to a component.

Parameters

Collapse all

    The component to which props will be added.

    The props to be added to the component.

Returns

    A new component that includes the default props.

withVariants

Set default className to a component using variants from class-variance-authority.

Parameters

Collapse all

    The component to which props will be added.

    The variants as the default className.

    The props to exclude from Component. Set the props that are only used for variants.

Returns

    A new component that includes the default className.