Skip to content

SpinButton

a primitive for creating a SpinButton component.

Anatomy

Figure: Anatomy of a SpinButton component

API Reference

createSpinbutton<T extends string | number>(args: SpinButtonArguments<T>): AriaSpinButton<T>;

Parameters [SpinButtonArguments]

Name Type Default Description
values * Array<T extends string | number> - The values to cycle through.
mapping string[] - Values to be mapped to a value if not descriptive enough.
step number 1 Changes the amount of items to increment or decrement by when using page up or page down keys.

Return value [AriaSpinButton]

Name Type Description
decrementButtonProps * JSX.HTMLAttributes<HTMLButtonElement> Props to spread on the decrement button element.
incrementButtonProps * JSX.HTMLAttributes<HTMLButtonElement> Props to spread on the increment button element.
inputProps * JSX.HTMLAttributes<HTMLInputElement> Props to spread on the input element.
state * { value: T } The current state of the SpinButton component.

Example

Screen reader