Skip to content

Latest commit

 

History

History
106 lines (71 loc) · 1.93 KB

switch.md

File metadata and controls

106 lines (71 loc) · 1.93 KB
title Switch
description UI component for toggling state on or off.
contributors
rigor789
Ombuweb

<Switch> is a UI component that lets users toggle between two states.

<<< @/../examples/typescript/src/ui/Switch/template.xml#example

<<< @/../examples/angular/src/ui/Switch/component.html#example

<<< @/../examples/react/src/components/ui/switch.tsx#example

<<< @/../examples/solid/src/ui/switch.tsx#example

<<< @/../examples/svelte/app/components/ui/Switch.svelte#example

<<< @/../examples/vue/src/ui/Switch/component.vue#example

Examples

Styling a Switch

<Switch checked="true"
  color="#BFCDAC"
  backgroundColor="green"
  offBackgroundColor="#DC493D"
/>

Props

checked

checked: boolean

Gets or sets the state switch.

Defaults to false.

offBackgroundColor

offBackgroundColor: Color

Gets or sets the off-state background color.

See Color.

...Inherited

For additional inherited properties, refer to the API Reference.

Events

checkedChange

on('checkedChange', (args: PropertyChangeData) => {
  const switch = args.object as Switch
  console.log('Switch checked:', switch.checked)
})

See PropertyChangeData.

Native component