stepper

package
v0.2.3 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 stepper provides a shadcn/ui-style stepper: a number with two arrow buttons that step it, and a label and a live readout, from the Stepper of MyGo.

stepper.Stepper(c, stepper.Props{
	Value: &port,
	Min:   1024,
	Max:   65535,
	Step:  1,
	Label: "Port",
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stepper

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

Stepper draws the label, the readout and the arrows, and returns the column. The readout follows the value as the user clicks or holds an arrow — it repeats, faster after a while — or presses the arrow keys, Home and End while the control has the focus, because the view builds every frame.

Types

type Props

type Props struct {
	// Value is the number being set.
	Value *float64
	// Min and Max bound the value.
	Min, Max float64
	// Step is how much the arrows and the arrow keys move the value.
	Step float64
	// Label is the text above the control, next to the readout.
	Label string
	// Format renders the readout; the default prints the rounded value.
	Format func(v float64) string
}

Props describes the stepper to draw.

Jump to

Keyboard shortcuts

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