button

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 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 ButtonFixtures = gx.Fixtures[ButtonProps]{
	"Default":     {Children: gx.Text("Button")},
	"Secondary":   {Variant: Secondary, Children: gx.Text("Secondary")},
	"Destructive": {Variant: Destructive, Children: gx.Text("Delete")},
	"Outline":     {Variant: Outline, Children: gx.Text("Outline")},
	"Ghost":       {Variant: Ghost, Children: gx.Text("Ghost")},
	"Link":        {Variant: Link, Children: gx.Text("Link")},
	"ExtraSmall":  {Size: Xs, Children: gx.Text("Extra small")},
	"Small":       {Size: Sm, Children: gx.Text("Small")},
	"Large":       {Size: Lg, Children: gx.Text("Large")},
	"WithIcon":    {Variant: Outline, Children: gx.Frag(gx.Text("Next"), icons.ChevronRight(icons.ChevronRightProps{}))},
	"Icon":        {Variant: Outline, Size: Icon, Attrs: iconLabel, Children: icons.ChevronRight(icons.ChevronRightProps{})},
	"IconXs":      {Variant: Outline, Size: IconXs, Attrs: iconLabel, Children: icons.ChevronRight(icons.ChevronRightProps{})},
	"IconSm":      {Variant: Outline, Size: IconSm, Attrs: iconLabel, Children: icons.ChevronRight(icons.ChevronRightProps{})},
	"IconLg":      {Variant: Outline, Size: IconLg, Attrs: iconLabel, Children: icons.ChevronRight(icons.ChevronRightProps{})},
	"Disabled":    {Attrs: gx.Attrs{gx.Bool("disabled", true)}, Children: gx.Text("Disabled")},
}

Functions

func Button

func Button(p ButtonProps) gx.Node

func Class

func Class(variant Variant, size Size, extra ...string) string

Class returns the classes of one button state. A link that looks like a button takes these classes on its anchor.

Types

type ButtonProps

type ButtonProps struct {
	// Variant sets the visual style: Default, Secondary, Destructive, Outline, Ghost or Link.
	Variant Variant
	// Size sets the height and padding: Xs, Sm, Md, Lg, or an Icon size for a square button.
	Size Size
	// Type is the type attribute: "button", "submit" or "reset".
	Type string
	// Class adds classes to the root element.
	Class string
	// Children is the button label.
	Children gx.Node
	// Attrs adds HTML attributes to the root element.
	Attrs gx.Attrs
}

type Size

type Size string

Size is the height and padding of a button.

const (
	Xs     Size = "xs"
	Sm     Size = "sm"
	Md     Size = "default"
	Lg     Size = "lg"
	Icon   Size = "icon"
	IconXs Size = "icon-xs"
	IconSm Size = "icon-sm"
	IconLg Size = "icon-lg"
)

The sizes of button.Button.

type Variant

type Variant string

Variant is the visual style of a button.

const (
	Default     Variant = "default"
	Secondary   Variant = "secondary"
	Destructive Variant = "destructive"
	Outline     Variant = "outline"
	Ghost       Variant = "ghost"
	Link        Variant = "link"
)

The variants of button.Button.

Jump to

Keyboard shortcuts

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