A toggle switch allows users to turn an option on or off. It provides a visual indicator of the current state and supports multiple color variants.

Goshtoso Component

Go + Templ

Default Toggle

Toggle with Container

Color Variations

Disabled States

Usage Example
// Default Toggle
@toggle.Toggle(toggle.Config{
    ID:      "myToggle",
    Label:   "Toggle",
    Checked: true,
})

// Toggle with Variant
@toggle.Toggle(toggle.Config{
    ID:      "successToggle",
    Label:   "success",
    Variant: toggle.Success,
    Checked: true,
})

// Toggle with Container
@toggle.Toggle(toggle.Config{
    ID:    "containerToggle",
    Label: "Toggle",
    Style: toggle.StyleContainer,
    Checked: true,
})

// Disabled Toggle
@toggle.Toggle(toggle.Config{
    ID:       "disabledToggle",
    Label:    "Disabled",
    Disabled: true,
})

This site uses localStorage to remember your theme preference. No tracking cookies.