Skip to content
  • Android
  • iOS
  • Web

Switch

A Switch component is a UI element that allows users to toggle between two states, typically representing an on/off or enabled/disabled choice. It is visually represented as a sliding toggle or checkbox and provides immediate feedback when the user interacts with it. Switch components are commonly used for settings, preferences, and feature activations in applications, enhancing user experience by simplifying the selection process.

Live examples

Example.tsx

Attributes

NSwitch attributes
NameTypeDefaultDetails
enabledbooleanOptional
defaultCheckedbooleanOptional
labelstringOptional
classNamestringOptionalSupported Tailwind-style utilities, resolved entirely in Rust. See the engine README.
labelClassNamestringOptional
onChange((value: boolean) => void)Optional
idstringOptional
checkedbooleanOptional
disabledbooleanOptional
valuebooleanOptional
Engine reference for SwitchSet up engine components

Tags