actionbutton

package
v0.5.30 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 5 Imported by: 0

README

ActionButton

Versatile button component with variant support.

Import

"github.com/tinywasm/components/actionbutton"

Usage

import "github.com/tinywasm/components/actionbutton"

btn := &actionbutton.ActionButton{
    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).
  • Href (string): When set, renders as <a href> instead of <button> — no click handler, works before WASM loads and with JavaScript disabled. Use this for navigation (e.g. an OAuth login link). OnClick is ignored when Href is non-empty.
  • OnClick (func(dom.Event)): Click handler. Ignored when Href is set.
loginLink := &actionbutton.ActionButton{
    Text:    "Sign in with Google",
    Variant: "primary",
    Href:    "/oauth/google",
}

Back to Catalog

Documentation

Index

Constants

View Source
const (
	PartPrimary     = widget.Part("primary")
	PartSecondary   = widget.Part("secondary")
	PartDanger      = widget.Part("danger")
	PartUrlUp       = widget.Part("url-up")
	PartUrlDown     = widget.Part("url-down")
	PartUrl         = widget.Part("url")
	PartUrlDisable  = widget.Part("url-disable")
	PartSelected    = widget.Part("selected")
	PartLogin       = widget.Part("login")
	PartUrlPulse    = widget.Part("url-pulse")
	PartContebuton  = widget.Part("contebuton")
	PartCenteredBtn = widget.Part("centered-btn")
)
View Source
const NameActionButton = widget.Name("actionbutton")

NameActionButton is the widget name for actionbutton.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionButton

type ActionButton struct {
	Element
	Text    string
	Variant string // "primary", "secondary", "danger"

	// Href renders the button as <a href> instead of <button>: no click
	// handler, works before WASM loads and with JavaScript disabled. Set
	// this for navigation (e.g. an OAuth login link); OnClick is ignored
	// when Href is non-empty.
	Href string

	OnClick func(Event)
}

func (*ActionButton) Render

func (b *ActionButton) Render() *Element

func (*ActionButton) RenderCSS

func (b *ActionButton) RenderCSS() *css.Stylesheet

RenderCSS defines the actionbutton visual contract using the style DSL.

func (*ActionButton) WidgetKind added in v0.1.13

func (b *ActionButton) WidgetKind() widget.Kind

func (*ActionButton) WidgetName added in v0.1.13

func (b *ActionButton) WidgetName() widget.Name

Jump to

Keyboard shortcuts

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