Checkbox

Represent a Material UI styled checkbox for toggling a boolean state.

Overview

The Checkbox provides a customizable checkbox with Material UI styling. It allows users to toggle between checked and unchecked states.

To use the Checkbox component, initialize it with a title and bind it to a Boolean value to control its state.

Initializer

Creates a checkbox with a specified title and state binding.

Checkbox(_ titleKey: String, isOn: Binding<Bool>)

Parameters

Parameter
Description

titleKey

The title displayed next to the checkbox.

isOn

A Binding<Bool> to control the checkbox's state.

Example

@State private var isChecked = false

var body: some View {
    Container {
        Checkbox("Toggle Checkbox", isOn: $isChecked)
    }
}

Last updated