Skip to content

Feature request: Automatically set button state colors #7585

@ethanroday

Description

@ethanroday

EDIT: I should clarify that these screenshots are from the Fluent UI experiment, but the overall question still stands.


Sometimes you need a one-off button that has a color outside of your main theme.
It would be great if there was an easy way to set the color for the default button state and have all of the other colors set automatically. As such, if I have the following code, here's what I see:

<DefaultButton className={[ColorClassNames.redBackground, ColorClassNames.white].join(" ")}>
  Don't Click This!
</DefaultButton>

Default:
image

Hover:
image

Pressed:
image


I can partially solve this by using some additional members from ColorClassNames, but the pressed state is still a little weird, and it would be great not to have to have this much boilerplate:

<DefaultButton
  className={[
    ColorClassNames.redBackground,
    ColorClassNames.redBorder,
    ColorClassNames.redDarkBackgroundHover,
    ColorClassNames.redDarkBorderHover,
    ColorClassNames.white,
    ColorClassNames.whiteHover
  ].join(" ")}
>
  Don't Click This!
</DefaultButton>

Default:
image

Hover:
image

Pressed:
image

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions