loadingbutton

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package loadingbutton provides the Loading Button expansion of shadcn/ui: a button that turns into a spinner while its work runs, and will not be clicked again until it is done.

loadingbutton.LoadingButton(c, loadingbutton.Props{
	Label:   "Save",
	Loading: app.saving,
	OnClick: save,
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadingButton

func LoadingButton(c *ui.Context, p Props) ui.Element

LoadingButton draws the button for props and returns it, so a view can chain more calls on it.

Types

type Props

type Props struct {
	// Label is what the button says; it keeps showing while Loading,
	// beside the spinner, so the button keeps its width.
	Label string
	// Loading turns the label into a spinner, and keeps the button from
	// being clicked, until the work it started finishes.
	Loading bool
	// OnClick runs for a click while the button is not loading.
	OnClick func()
}

Props describes the button to draw.

Jump to

Keyboard shortcuts

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