togglegroup

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ToggleGroupFixtures = gx.Fixtures[ToggleGroupProps]{
	"Three":         {Label: "Alignment", Children: align("align")},
	"Outline":       {Label: "Alignment", Variant: Outline, Children: align("align-outline")},
	"Spaced":        {Label: "Alignment", Spacing: 2, Children: align("align-spaced")},
	"OutlineSpaced": {Label: "Alignment", Variant: Outline, Spacing: 2, Children: align("align-outline-spaced")},
	"Small":         {Label: "Alignment", Variant: Outline, Size: Sm, Children: align("align-small")},
	"Large":         {Label: "Alignment", Variant: Outline, Size: Lg, Children: align("align-large")},
	"Multiple": {Label: "Format", Variant: Outline, Children: gx.Frag(
		ToggleGroupItem(ToggleGroupItemProps{Name: "bold", Value: "on", Multiple: true, Checked: true, Children: gx.Text("Bold")}),
		ToggleGroupItem(ToggleGroupItemProps{Name: "italic", Value: "on", Multiple: true, Checked: true, Children: gx.Text("Italic")}),
		ToggleGroupItem(ToggleGroupItemProps{Name: "strike", Value: "on", Multiple: true, Disabled: true, Children: gx.Text("Strike")}),
	)},
}
View Source
var ToggleGroupItemFixtures = gx.Fixtures[ToggleGroupItemProps]{
	"Checked":  {Name: "align-demo", Value: "left", Checked: true, Children: gx.Text("Left")},
	"Disabled": {Name: "align-disabled", Value: "left", Disabled: true, Children: gx.Text("Left")},
}

Functions

func ToggleGroup

func ToggleGroup(p ToggleGroupProps) gx.Node

func ToggleGroupItem

func ToggleGroupItem(p ToggleGroupItemProps) gx.Node

func ToggleGroupItemWrap

func ToggleGroupItemWrap(n gx.Node) gx.Node

ToggleGroupItemWrap renders the item inside a group, as a page uses it.

Types

type Size

type Size string

Size is the height of the items of a toggle group.

const (
	Sm Size = "sm"
	Md Size = "md"
	Lg Size = "lg"
)

The sizes of togglegroup.ToggleGroup.

type ToggleGroupItemProps

type ToggleGroupItemProps struct {
	// Name is the form field name. Every item of an exclusive group has the same name.
	Name string
	// Value is the value the form submits when the item is checked.
	Value string
	// Checked selects the item for the first render.
	Checked bool
	// Multiple renders a checkbox in place of a radio, so the item toggles on its own.
	Multiple bool
	// Disabled disables the item.
	Disabled bool
	// Class adds classes to the root element.
	Class string
	// Children is the item label.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type ToggleGroupProps

type ToggleGroupProps struct {
	// Variant sets the visual style of every item: Default or Outline.
	Variant Variant
	// Size sets the height of every item: Sm, Md or Lg.
	Size Size
	// Spacing is the gap between the items in spacing units. Zero joins the items.
	Spacing int
	// Label is the accessible name of the group.
	Label string
	// Class adds classes to the root element.
	Class string
	// Children is the toggle items.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type Variant

type Variant string

Variant is the visual style of the items of a toggle group.

const (
	Default Variant = "default"
	Outline Variant = "outline"
)

The variants of togglegroup.ToggleGroup.

Jump to

Keyboard shortcuts

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