MyGo
Number input

Text input

Number input

A number in a range, typed or stepped.

Number input

ui.NumberInput creates a text input editing a *float64 as a number between two bounds, which Up and Down, and the buttons beside it, change by a step. What is typed applies as soon as it is a number in range, and shows rounded to the decimals of the step once the input loses the focus. Changed reports a new value. A Width sizes the whole input, its buttons included: the field narrows to keep them within it.

ui.NumberInput(c, &app.copies, 1, 99, 1).Label("Copies")
ui.NumberInput(c, &app.opacity, 0, 1, 0.05).Label("Opacity")

For a value the user only steps, use a stepper; for one chosen roughly, a slider; for an amount of money, which a float64 cannot hold exactly, a decimal input.

Accessibility

Assistive technology sees a spin button of the value, named by its Label or its field, which it increments and decrements by the step.