Checkbox
Нативный булев контрол формы.
github.com/fastygo/templ/ui
Чекбокс рендерит нативный булев контрол формы. Используйте для согласий и переключателей настроек.
Не отмечен
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Checkbox(ui.CheckboxProps{Name: "terms", ID: "terms"})
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Checkbox(ui.CheckboxProps{Name: "terms", ID: "terms"})
}
Отмечен
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Checkbox(ui.CheckboxProps{Name: "terms", ID: "terms", Checked: true})
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Checkbox(ui.CheckboxProps{Name: "terms", ID: "terms", Checked: true})
}
Неактивный
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Checkbox(ui.CheckboxProps{Name: "locked", Disabled: true, Checked: true})
}
import "github.com/fastygo/templ/ui"
templ Example() {
@ui.Checkbox(ui.CheckboxProps{Name: "locked", Disabled: true, Checked: true})
}
API
Name · string — Имя поля формы
Checked · bool — Отмеченное состояние
Disabled · bool — Неактивное состояние
AriaLabel · string — Доступное имя без видимой метки