button

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 2 Imported by: 0

README

Button Component

Versatile button component with variant support.

Import

"github.com/tinywasm/components/button"

Usage

btn := &button.Button{
    Text: "Save Changes",
    Variant: "primary",
    OnClick: func(e dom.Event) {
        fmt.Println("Saved!")
    },
}

Properties

  • Text (string): The button label.
  • Variant (string): Visual style (primary, secondary, danger).
  • OnClick (func(dom.Event)): Click handler.

CSS Variables

  • --color-primary
  • --color-secondary
  • --color-error

Back to Catalog

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	*dom.Element
	Text    string
	Variant string // "primary", "secondary", "danger"
	OnClick func(dom.Event)
}

func (*Button) IconSvg added in v0.0.5

func (b *Button) IconSvg() map[string]string

func (*Button) Render added in v0.0.5

func (b *Button) Render() *dom.Element

func (*Button) RenderCSS

func (b *Button) RenderCSS() string

Jump to

Keyboard shortcuts

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