Toggle

toggle

Toggle is a switcher between two states. Most common toggles are used to switch between as on/off in preferences or settings.

Usage

toggle

import SwiftUI

struct ExampleView: View {
    @State var toggle:Bool = false
    var body: some View {
        Toggle(isOn: $toggle, label: {
            Text("Label")
                .xelaButtonMedium()
        })
        .toggleStyle(XelaToggleStyle())
        .padding()
    }
}

Properties XelaToggleStyle

Name Type Default Value Required Description
icon String NO Icon name from Assets on toggle
size XelaToggleSize .Large NO Toggle size (.Large, .Medium, .Low)
onBackgound Color Color(xelaColor: .Blue3) NO Toggle ON background
offBackground Color Color(xelaColor: .Gray11) NO Toggle OFF background
iconOnColor Color Color(xelaColor: .Blue3) NO Toggle ON icon color
iconOffColor Color Color(xelaColor: .Gray8) NO Toggle OFF icon color
circleOnColor Color Color(.white) NO Toggle ON circle color
circleOffColor Color Color(.white) NO Toggle OFF circle color
isEmptyLabel Bool false NO Is empty toggle label