Skip to content

Switch styles customization #15418

@mgarv-amzn

Description

@mgarv-amzn

The current Switch component allows you to customize:

  • trackColor: just the background, depending on 'false' or 'true' values
  • thumbColor: if you need to change it depending on the same values allowed for the trackColor you need to create a local state to track if it's true or false (enabled or disabled)

The issue is that:

  1. There is no consistent way to define colors for true and false values, you need to add extra logic for the thumbColor
  2. The only thing you can customize is the background color, there is no option if you want to display just a border when the value is false to match a minimal design. You need to do a workaround if you want to add a custom border also depending on the value.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions