Switch - Usage
The Switch component allows users to toggle between two states.
AndroidreleasedElementsreleasediOSreleasedReactreleasedVuereleased
iOS
Syntax
swift
Warp.Switch(
isOn: Binding<Bool>,
state: Warp.SwitchState = .default
)swift
Warp.Switch(isOn: $isOn)Visual options
There are a variety of variants supported for the Switch component:
swift
enum Warp.SwitchState {
case `default`
case disabled
}Legacy support
By default all Warp components return a SwiftUI View but there is always a UIKit UIView available to use also.
swift
Warp.Switch(isOn: $isOn).uiViewParameters
Required props
| Name | Type | Default | Description |
|---|---|---|---|
| isOn | Binding Bool | Binding to a Boolean value indicating whether the switch is on or off. |
Optional Props
| Name | Type | Default | Description |
|---|---|---|---|
| state | Warp.SwitchState | .default | The state of the switch. Use one of the predefined SwitchState values: .default, or .disabled |
Questions?
Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system