button

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

templ: version: v0.2.793

templ: version: v0.2.793

Index

Constants

View Source
const (
	Primary   Variant = "primary"
	Secondary Variant = "secondary"
	Text      Variant = "text"
	Delete    Variant = "delete"
	Error     Variant = "error"
	Warning   Variant = "warning"
	Success   Variant = "success"
	Info      Variant = "info"
	Icon      Variant = "icon"
	Gray      Variant = "gray"

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

Variables

This section is empty.

Functions

func Button

func Button(props *Props) templ.Component

func Showcase

func Showcase() templ.Component

Types

type Props

type Props struct {
	// Variant determines the visual style of the button.
	Variant Variant `default:"primary"`

	// Label is the content of the button.
	// Default: "" (empty string)
	Label string

	// Size sets the size of the button.
	Size Size `default:"md"`

	// FullWidth determines whether the button should take up the full width of its container.
	// Default: false
	FullWidth bool

	// Click is the JavaScript function to be called when the button is clicked. Usuallu by AlpineJS
	// Default: ""
	Click string

	// Prevent is a bool to indicate whether the default action should occur onClick
	// Default: false
	Prevent bool

	// HX allows passing additional HTMX attributes to the button or anchor element.
	// Default: nil
	HX htmx.Props

	// Disabled can be either a bool or a string.
	// If bool (Go), it directly controls the disabled state.
	// If string, it's treated as a JavaScript expression for dynamic disabling.
	Disabled bool

	// IconLeft specifies an icon component to be displayed on the left side of the button text.
	// Use IconLeft with a label for an Icon button
	// Default: nil
	IconLeft templ.Component

	// IconRight specifies an icon component to be displayed on the right side of the button text.
	// Default: nil
	IconRight templ.Component

	// Content - for truly dynamic button content
	// Default: nil
	Content templ.Component

	// Class specifies additional CSS classes to apply to the button to override any previous class.
	// Default: "" (empty string)
	Class string

	// Attrs allows passing additional HTML attributes to the button or anchor element.
	// Default: nil
	Attrs templ.Attributes
}

type Size

type Size string

type Variant

type Variant string

Jump to

Keyboard shortcuts

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