# Number input

<!-- preview number-input 160 -->

`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.

```go
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](https://mygo.egoist.dev/docs/ui/stepper.md); for one
chosen roughly, a [slider](https://mygo.egoist.dev/docs/ui/slider.md); for an amount of money, which a
`float64` cannot hold exactly, a [decimal input](https://mygo.egoist.dev/docs/ui/decimal-input.md).

## Accessibility

Assistive technology sees a spin button of the value, named by its `Label`
or its [field](https://mygo.egoist.dev/docs/ui/form.md), which it increments and decrements by the step.
