Skip to main content Red Hat Design System logo Contribute on Github v1.4.5

Switch

Overview Style Guidelines Code Demos Accessibility

Installation

Usage

<rh-switch id="a" checked></rh-switch>
<label for="a">
<span data-state="on">Message when on</span>
<span data-state="off" hidden>Message when off</span>
</label>

rh-switch

Slots 0

None

Attributes 8
DOM Property Description Type Default
label
string | undefined
unknown
showCheckIcon
boolean
false
checked
boolean
false
disabled
boolean
false
accessibleLabel
string | undefined
unknown
messageOn
string | undefined
unknown
messageOff
string | undefined
unknown
reversed
boolean
false
Methods 1
Method Name Description
formDisabledCallback(disabled: boolean)
Events 1
Event Name Description
change
CSS Shadow Parts 0

None

CSS Custom Properties 3
CSS Property Description Default
--rh-switch-unchecked

The background color of the switch when it is unchecked.

--rh-switch-checked

The background color of the switch when it is checked.

--rh-switch-disabled

The background color of the switch when it is disabled.

Design Tokens 0

None

© 2021-2024 Red Hat, Inc. Deploys by Netlify