Skip to content
Overlay ColorModeSwitch

ColorModeSwitch

A switch that is on in dark mode.

On this page

Examples

Color mode switch

Razor
<KlyColorModeSwitch data-testid="color-mode-switch" />
<KlyColorModeSwitch Label="Dark mode" Size="KlySize.Lg" />

API

KlyColorModeSwitch

Switch that is on in dark mode.

Parameters

Name Type Default Description
AriaLabel string Accessible name when there is no visible label. Defaults to the built-in text.
Class string Classes added to the root element, merged last so they win over the theme.
Color KlyColor "primary" Semantic color of the color mode switch: a built-in KlyColor or the name of a color you defined. When not set, Color applies, else the default of the component. Values: primary, secondary, success, info, warning, error, neutral.
Label string Visible label. Without it the switch needs AriaLabel .
Size KlySize KlySize.Md Size of the color mode switch, from Xs to Xl . When not set, Size applies, else the default of the component. Values: Xs, Sm, Md, Lg, Xl.
Ui ColorModeSwitchUi Per-instance class overrides of the slots of the color mode switch, see ColorModeSwitchUi . They are merged after the theme and the Class parameter wins on the root slot.

Ui slots

Ui takes a ColorModeSwitchUi with one class string per slot, merged after the theme.

Slot Styles
Root Classes merged into the root slot of KlyColorModeSwitch , after the theme and the app configuration.
Container Classes merged into the container slot of KlyColorModeSwitch , after the theme and the app configuration.
Input Classes merged into the input slot of KlyColorModeSwitch , after the theme and the app configuration.
Thumb Classes merged into the thumb slot of KlyColorModeSwitch , after the theme and the app configuration.
Moon Classes merged into the moon slot of KlyColorModeSwitch , after the theme and the app configuration.
Sun Classes merged into the sun slot of KlyColorModeSwitch , after the theme and the app configuration.
Wrapper Classes merged into the wrapper slot of KlyColorModeSwitch , after the theme and the app configuration.
Label Classes merged into the label slot of KlyColorModeSwitch , after the theme and the app configuration.