Skip to content

allow label field to accept a ReactNode#4

Open
its-deku wants to merge 1 commit intoMattis44:mainfrom
its-deku:to_react_node
Open

allow label field to accept a ReactNode#4
its-deku wants to merge 1 commit intoMattis44:mainfrom
its-deku:to_react_node

Conversation

@its-deku
Copy link

@its-deku its-deku commented Oct 4, 2025

No description provided.

@Mattis44
Copy link
Owner

Mattis44 commented Oct 4, 2025

Do we need to render the span between the new label ? i guess it can be better to accept both string and React.ReactNode.
In case user provides ReactNode, we don't render span as they're not necessary.
In case user provides string, we render the span.

So, we could have :

interface ItemProps {
    icon?: React.ReactNode;
    action?: () => void;
    label: string | React.ReactNode;
    helper?: string;
    isActive?: boolean;
}

And we render this :

{typeof label === "string" ? (
                    <span>
                        {label}
                    </span>
                ) : (
                    label
                )}

Tell me what do you think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants