Skip to content

[Bug]: Button component does not accept style prop as documented #3621

Open
@hv90

Description

@hv90

Browser

No response

Package version

3.0.1006

React version

19.0.0

Description

Hello Cloudscape team,

I am experiencing an issue with the Button component. According to your documentation ( Button API ), the Button component should accept a style prop of type ButtonProps.Style. However, when I try to use the style prop, TypeScript throws the following error:

Type '{ children: (string | number)[]; variant: "inline-link"; iconName: "status-warning"; onClick: () => void; style: { root: {}; }; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes'.
Property 'style' does not exist on type 'IntrinsicAttributes & ButtonProps & RefAttributes'.ts(2322)

After importing the component:
import { Button } from "@cloudscape-design/components";

Here is a code snippet that reproduces the issue:

<Button
  variant="inline-link"
  iconName="status-warning"
  onClick={() => { /* ... */ }}
  style={{ root: {} }}
>
  Example
</Button>

The Button component should accept the style prop as described in the documentation.
TypeScript reports that the style prop does not exist on the Button component.

Could you clarify if the documentation is incorrect, or if the type definitions and implementation are missing support for the style prop?

Source code

<Button
variant="inline-link"
iconName="status-warning"
onClick={() => { /* ... */ }}
style={{ root: {} }}

Example

Reproduction

<Button
variant="inline-link"
iconName="status-warning"
onClick={() => { /* ... */ }}
style={{ root: {} }}

Example

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions