0

Using DefaultButton currently. This remains selected when clicked, which property can be used to revoke selection once clicked.

Alternatively, is there any styling that needs to be done for selection?

unknown_boundaries
  • 1,482
  • 3
  • 25
  • 47

1 Answers1

0

You can use DefaultButton checked property for that scenario and control it with onClick event:

const [isButtonChecked, setIsButtonChecked] = React.useState(false);

<DefaultButton
  checked={isButtonChecked}
  onClick={() => {
    setIsButtonChecked(!isButtonChecked);
  }}
  styles={{
    rootChecked: {
      backgroundColor: '#f00',
      color: '#fff',
    }
  }}
>
  Default Button
</DefaultButton>

Use styles property to modify button styles when button state is checked: rootChecked, rootCheckedHovered etc.

Codepen example.

Marko Savic
  • 2,159
  • 2
  • 14
  • 27