Thanks to visit codestin.com
Credit goes to github.com

Skip to content

useId hook assumes that "label" is always a string but according to docs it can be a ReactNode #1542

@gnpgt

Description

@gnpgt

Hi there,

I'm not sure if this is a bug or am I misusing the Checkbox component.

Checkbox uses useId hook:

It looks like this hook assumes that the "label" prop is always a string and if it's provided it will call "replace" on it.

According to RMWC docs label can be a ReactNode and if I pass a react node as a label I get an error:

Error: Uncaught [TypeError: r.replace is not a function]

I'm using:
"@rmwc/base": "^14.3.3",
"@rmwc/checkbox": "~14.3.3"
Node 20.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions