Skip to content

EThemeSwitch Theme switch ​

import EUI 1.0

Examples ​

Theme switch ​

QML sourceQML
Preview
Run the code to try the component

Edit text, properties, or events, then select Run.

Code runs in this browser Licenses

Properties ​

PropertyDescriptionValues and default
accessibleNamestring

Name read by assistive technologies; provide a readable name for controls without text.

Defaulttext
activeColorcolor

Active or selected color.

DefaultDynamic binding
activeIconint

Icon used by the component.

EIcons.*
0 (no icon)

Default0
activeTextstring

Text for the active or inactive state.

Default""
activeValuevar

Value associated with checked or active state.

Defaulttrue
beforeChangevar

Guard before changing switch state, returning a boolean or Promise.

Defaultnull
checkedbool

Whether the control is checked or active.

Defaultfalse
darkBorderColorcolor

Switch border color in the dark or light theme.

DefaultDynamic binding
darkIconColorcolor

Switch icon color in the dark or light theme.

DefaultDynamic binding
darkThumbColorcolor

Switch thumb color in the dark or light theme.

DefaultDynamic binding
darkTrackColorcolor

Switch track color in the dark or light theme.

DefaultDynamic binding
durationint

Animation or display duration in milliseconds; the component binding identifies its use.

Default300
enabledbool

Allow interaction; false disables the control.

Defaulttrue
fontfont

Font settings for the family, size and text style.

Common fields:
family, pixelSize, pointSize
bold, italic, weight
underline, strikeout
letterSpacing, wordSpacing

Defaultapplication font
heightreal

Component size in pixels; may be bound to its parent layout.

DefaultimplicitHeight
inactiveColorcolor

Inactive color.

DefaultDynamic binding
inactiveIconint

Icon used by the component.

EIcons.*
0 (no icon)

Default0
inactiveTextstring

Text for the active or inactive state.

Default""
inactiveValuevar

Value associated with unchecked or inactive state.

Defaultfalse
lightBorderColorcolor

Switch border color in the dark or light theme.

DefaultDynamic binding
lightIconColorcolor

Switch icon color in the dark or light theme.

DefaultDynamic binding
lightThumbColorcolor

Switch thumb color in the dark or light theme.

DefaultDynamic binding
lightTrackColorcolor

Switch track color in the dark or light theme.

DefaultDynamic binding
loadingbool

Whether the component is loading.

Defaultfalse
sizeint

Control size; inherits the nearest EConfigProvider by default.

EStyle.Small
EStyle.Medium
EStyle.Large

DefaultInherited; EStyle.Medium by default
textstring

Displayed text.

Defaultchecked ? activeText : inactiveText
transitionDurationint

Animation or display duration in milliseconds; the component binding identifies its use.

Default400
validateEventbool

Request enclosing-form validation when the value changes.

Defaulttrue
valuevar

Current value; read or write through property bindings, with arrays for multiple or range selection.

Defaultundefined
visiblebool

Whether the component is visible.

Defaulttrue
widthreal

Component size in pixels; may be bound to its parent layout.

DefaultimplicitWidth
captureRootItemRead only

Source capture item or animation overlay for theme transitions.

DefaultComputed at runtime
darkboolRead only

Whether the dark theme is active.

DefaultComputed at runtime
transitionRootItemRead only

Source capture item or animation overlay for theme transitions.

DefaultComputed at runtime

Signals ​

SignaturePurpose
changeRejected(string message)

Emitted when a state change is rejected; message explains why.

themeChangeRequested()

Emitted when the user requests a theme change; connect application theme handling here.

Released under the MIT License. Third-party assets retain their own licenses.