checkboxgroup

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

templ: version: v0.2.793

Index

Examples

Constants

View Source
const (
	StyleHorizontal        style.Style = 1 << 8
	StyleBordered          style.Style = 1 << 9
	StyleGrouped           style.Style = 1 << 10
	StyleGroupedHorizontal style.Style = 1 << 11
	StyleLabelOnly         style.Style = 1 << 12
)

Variables

This section is empty.

Functions

func C

func C(def D) templ.Component
Example
package main

import (
	"context"
	"os"

	"github.com/jfbus/templui/components/checkbox"
	"github.com/jfbus/templui/components/checkboxgroup"
)

func main() {
	c := checkboxgroup.C(checkboxgroup.D{
		Name: "group",
		Checkboxes: []checkbox.D{
			{Label: "Option 1", Value: "1"},
			{Label: "Option 2", Value: "2"},
		},
	})
	_ = c.Render(context.TODO(), os.Stdout)
}
Output:

Types

type D

type D struct {
	// Name is the Name of all inputs.
	Name string
	// Style is the checkboxgroup style.
	Style style.Style
	// Checkboxes is the list of checkboxes in the group.
	//playground:import:github.com/jfbus/templui/components/checkbox
	//playground:default:[]checkbox.D{{Name: "foo", Value: "1", Label: "Choice 1"},{Name: "foo", Value: "2", Label:"Choice 2"}}
	Checkboxes []checkbox.D
	// Message adds a validation message below the field.
	// Just add &message.D{} to add automatic validation.
	//playground:import:github.com/jfbus/templui/components/form/validation/message
	//playground:default:&message.D{Message: "Validation message"}
	Message *message.D
	// CustomStyle defines a custom style.
	// 	style.Custom{
	// 		"checkboxgroup":       style.D{style.Add("...")},
	// 		"checkboxgroup/checkbox":       style.D{style.Add("...")},
	// 		"checkboxgroup/checkbox/input": style.D{style.Add("...")},
	// 		"checkboxgroup/checkbox/label": style.D{style.Add("...")},
	//	}
	CustomStyle style.Custom
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL