Skip to content

Allow Button children to accept React.ReactNode #3992

@jessie-JNing

Description

@jessie-JNing

Feature request summary

We are building a plain button, who would be displayed at a polaris Badge, however, the button children does not accept React.ReactNode type.

Rationale

The button we are building is like below:

const status =(<Badge status="success">Passing</Badge>);
const activator = (
    <Button plain onClick={togglePopoverActive} disclosure>
      {status}
    </Button>
  );

The react typecheck complains {status}: error TS2322: Type 'Element' is not assignable to type 'string | string[] | undefined', this is because https://github.com/Shopify/polaris-react/blame/main/src/components/Button/Button.tsx#L25

We think users should be given more flexibility on building their buttons, give more style and etc.


🌟 Feature requests that are not yet planned will be closed. We then use the issue’s 👍 upvotes to track and set priorities. See the contribution guidelines for more information.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions