logo

Pacis

Github
  1. Docs
  2. Button

Button

Displays a button or a component that looks like a button.

Button(Text("Button"))

Usage

import (
	. "github.com/canpacis/pacis/ui/components"
)
Button(Text("Button"))

Examples

Primary variant

Button(
	Text("Button"),
)

Secondary variant

Button(
	ButtonVariantSecondary,
	
	Text("Secondary"),
)

Outline variant

Button(
	ButtonVariantOutline,

	Text("Outline"),
)

Destructive variant

Button(
	ButtonVariantDestructive,

	Text("Destructive"),
)

Ghost variant

Button(
	ButtonVariantGhost,

	Text("Ghost"),
)
Button(
	ButtonVariantLink,

	Text("Link"),
)

Sizes

Frag( // <- HTML Fragment
	Button(
		ButtonSizeSm,

		Text("Small"),
	),
	Button(
		Text("Default"),
	),
	Button(
		ButtonSizeLg,

		Text("Large"),
	)
)

Icon

Button(
	ButtonSizeIcon,
	ButtonVariantOutline,

	icons.EllipsisVertical(),
)
Button(
	Replace(A), // <- Replace with an anchor tag
	Href("#button-as-link"), // <- Provide an href
	ButtonVariantOutline,

	Text("This is a link"),
)

With an event handler

Button(
	On("click", "alert('Clicked')"), // <- This comes from the components module

	Text("Press Me!"),
)

API

Events

All the events of a regular DOM button element is passed to this node