Toggle
A component that can be a fast indicator for switching a state replacing the form of sending the form. It can also be used as a switch to show a new content. It can act as an independent component or include the form components.
ToggleBosons
Id
Id of checkbox inside toggle.
type:
string
Checked
Information about checked input
type:
bool
default:
false
Size
Component size
type:
string
default:
md
values:
sm, md, lg
Attrs
Sets attributes in the html tag.
type:
gopress.Attrs
Examples
Sizes for toggle
sm
md
lg
1// Sizes for toggle
2
3@docs.Item("sm", true) {
4 @protons.Toggle(&protons.ToggleBosons{Size: "sm"})
5}
6@docs.Item("md", true) {
7 @protons.Toggle(&protons.ToggleBosons{Size: "md"})
8}
9@docs.Item("lg", true) {
10 @protons.Toggle(&protons.ToggleBosons{Size: "lg"})
11}
Toggle with label and checked input
Switch label title
1// Toggle with label
2
3@protons.Toggle(&protons.ToggleBosons{Size: "lg", Checked: true}) {
4 Switch label title
5}
Checkbox for toggle
Toggle button uses `input type="checkbox"` and require `id` for proper operation.