Reference
NumberInput
A number with − and + beside it: the arrow keys step it, PageUp and PageDown by ten steps, and it stays between min: and max:.
NumberInput(bind: State, min: Number, max: Number, …)
Since 6.2.0
min
max
step
label
hint
Ten at most per order.
Total: $90
Example
state tickets = 2
NumberInput(bind: tickets, min: 1, max: 10, step: 1, label: "Tickets", hint: "Ten at most per order.")
Text("Total: ${tickets * 45}").muted
Larger steps
state storage = 50
NumberInput(bind: storage, min: 10, max: 1000, step: 10, label: "Storage (GB)")
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
bind: | State (required) | — | The |
min: | Number | none | The lowest value: − is disabled there, and the buttons and PageDown never go below it (a typed value is not held to it) |
max: | Number | none | The highest value: + is disabled there, and the buttons and PageUp never go above it (a typed value is not held to it) |
step: | Number | 1 | How far −, + and the arrow keys move it; PageUp and PageDown move ten steps |
label: | String | none (the input is named | Visible label; also the input's accessible name |
hint: | String | none | Help text under the control, linked to it by |
Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.
Flags and cases
A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.
No flags of its own.
Events
Every element also takes the props, the events and the attribute families listed on every element.
Slots
It takes no slots.
Drawn for it
What NumberInput draws itself, by the class a stylesheet can select. They are not written.
| Part | Class | Meaning |
|---|---|---|
NumberInput.Decrease | — | Its − button. |
NumberInput.Increase | — | Its + button. |
Renders with the class wf-number-input, stable across releases, so a stylesheet may target it.