button

package
v0.0.0-...-c353a36 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

templ: version: v0.3.1001

Package button renders a native button element or SafeURL anchor — no presets, Class/Attrs slots only.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Button

func Button(props ButtonProps, label string) templ.Component
Example
package main

import (
	"bytes"
	"context"
	"fmt"

	"github.com/fastygo/base/button"
)

func main() {
	var buf bytes.Buffer
	cmp := button.Button(button.ButtonProps{Class: "actions-primary"}, "Save")
	if err := cmp.Render(context.Background(), &buf); err != nil {
		panic(err)
	}
	fmt.Print(buf.String())
}
Output:
<button type="button" class="actions-primary">Save</button>

func ButtonBlock

func ButtonBlock(props ButtonProps) templ.Component

Types

type ButtonProps

type ButtonProps struct {
	ID        string
	Role      string
	TabIndex  string
	Attrs     templ.Attributes
	Href      string
	Class     string
	Type      string
	AriaLabel string
	Disabled  bool
}

ButtonProps maps to native behaviors; styling is Caller-controlled via Class and Attrs.

Jump to

Keyboard shortcuts

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