toggle

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 1 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 ToggleFixtures = gx.Fixtures[ToggleProps]{
	"Off":       {Name: "bold", Children: gx.Text("Bold")},
	"On":        {Name: "bold", Pressed: true, Children: gx.Text("Bold")},
	"Disabled":  {Name: "bold", Disabled: true, Children: gx.Text("Bold")},
	"Outline":   {Name: "bold", Variant: Outline, Children: gx.Text("Bold")},
	"OutlineOn": {Name: "bold", Variant: Outline, Pressed: true, Children: gx.Text("Bold")},
	"Invalid":   {Name: "bold", Variant: Outline, Invalid: true, Children: gx.Text("Bold")},
	"Small":     {Name: "bold", Variant: Outline, Size: Sm, Children: gx.Text("Bold")},
	"Large":     {Name: "bold", Variant: Outline, Size: Lg, Children: gx.Text("Bold")},
}

Functions

func Toggle

func Toggle(p ToggleProps) gx.Node

Types

type Size

type Size string

Size is the height and padding of a toggle.

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

The sizes of toggle.Toggle.

type ToggleProps

type ToggleProps struct {
	// Variant sets the visual style: Default or Outline.
	Variant Variant
	// Size sets the height and padding: Sm, Md or Lg.
	Size Size
	// Name is the form field name.
	Name string
	// Value is the value the form submits when the toggle is pressed.
	Value string
	// Pressed sets the toggle to pressed for the first render.
	Pressed bool
	// Disabled disables the toggle.
	Disabled bool
	// Invalid sets aria-invalid on the input and shows the error style.
	Invalid bool
	// Class adds classes to the root element.
	Class string
	// Children is the toggle label.
	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 a toggle.

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

The variants of toggle.Toggle.

Jump to

Keyboard shortcuts

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