Skip to content

Switch

A switch is a on/off indicator that represents some boolean value.

You can create a basic switch as so:

go
FormSwitch("Active")

Common Methods

For a list of common field component methods, see here.

Checkbox

The Checkbox method allows you to convert your switch into a checkbox:

go
// static
FormSwitch("Active").
    Checkbox()
    
// callback
FormSwitch("Active").
    CheckboxFn(fn func(ctx *ctxPage.Field[T]) bool{
        return true
    })

Released under the MIT License.