FormCheckbox

Checkboxes in forms.

CheckboxBosons

Error
Is there any error.
type: bool
default: false
Checked
required
Information about checked input
type: bool
default: false
Attrs
Sets attributes in the html tag.
type: gopress.Attrs

Examples

Single checkbox
 1// Default checkbox
 2@protons.Checkbox(&protons.CheckboxBosons{})
 3
 4// Checkbox with error
 5@protons.Checkbox(&protons.CheckboxBosons{Error: true})
 6
 7// Disabled checkbox
 8@protons.Checkbox(&protons.CheckboxBosons{Attrs: gopress.Attrs{
 9  "disabled": "",
10}})
Two checkboxes in field after validation
Please, check some options
 1// Two checkboxes
 2
 3@atoms.FormField(&atoms.FormFieldBosons{Template: "checkbox"}) {
 4  @atoms.FormCheckbox(&atoms.FormCheckboxBosons{
 5    Error:   false,
 6    Checked: false,
 7    Attrs: gopress.Attrs{
 8      "name":  "single",
 9      "id":    "single1",
10      "value": "single-value",
11    },
12  }) {
13    @atoms.FormLabel(&atoms.FormLabelBosons{Text: "Single checkbox label", Pointer: true, For: "single1"})
14  }
15  @atoms.FormCheckbox(&atoms.FormCheckboxBosons{
16    Error:   false,
17    Checked: false,
18    Attrs: gopress.Attrs{
19      "name":  "single",
20      "id":    "single1",
21      "value": "single-value",
22    },
23  }) {
24    @atoms.FormLabel(&atoms.FormLabelBosons{Text: "Single checkbox label", Pointer: true, For: "single1"})
25  }
26  @atoms.FormValid(&atoms.FormValidBosons{Error: "Please, check some options"})
27}

Let's dive deeper and connect!

Gopress is brought to you by Pay For Done. We specialize in crafting products and services rooted in design systems. Join our community to discuss how we can support you.


© 2024 Pay For Done. All Rights Reserved. Website compliant with W3C validation.