This documentation is under construction. Pages can be missing or change at any time. Follow it on GitHub.

Skip to content

Number Field

A numeric input element with increment and decrement buttons, and a scrub area.

API reference#

Import the components of the family:

use function Phem\Ui\{NumberField, NumberFieldScrubArea, NumberFieldScrubAreaCursor, NumberFieldGroup, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement};

NumberField#

A text input for a number, with steppers and a scrub area: Base UI NumberField.Root, on the phem-number-field controller. With a name (or phem:bind), a hidden input keeps the raw value for the form. format takes the options of Intl.NumberFormat.

PropTypeDefault
defaultValue?floatnull
min?floatnull
max?floatnull
stepfloat1
smallStepfloat0.1
largeStepfloat10
allowOutOfRangeboolfalse
snapOnStepboolfalse
allowWheelScrubboolfalse
format?arraynull
locale?stringnull
disabledboolfalse
readOnlyboolfalse
requiredboolfalse
name?stringnull
value?Boundnull
children?Htmlnull
...restmixed—

NumberFieldScrubArea#

An area that changes the value when the user drags in it, such as the label.

PropTypeDefault
children?Htmlnull
...restmixed—

NumberFieldScrubAreaCursor#

The virtual cursor that shows while the user drags in the scrub area.

PropTypeDefault
children?Htmlnull
...restmixed—

NumberFieldGroup#

The group of the input and its two buttons.

PropTypeDefault
children?Htmlnull
...restmixed—

NumberFieldInput#

The text input of the number. The arrow keys change the value by the step.

The input and the buttons of a group have the radius on the outer corners of the group (first:rounded-s-control last:rounded-e-control). To change these corners, use the same variants: first:rounded-s-none last:rounded-e-none.

PropTypeDefault
...restmixed—

NumberFieldDecrement#

The button that takes a step from the value. A press that stays repeats it.

PropTypeDefault
children?Htmlnull
...restmixed—

NumberFieldIncrement#

The button that adds a step to the value. A press that stays repeats it.

PropTypeDefault
children?Htmlnull
...restmixed—

The source of the examples: examples/ui/NumberField.phem.

Phem
Esc
↑↓ to navigate↵ to openEsc to close