Leave Yamada UI a star

Star
Yamada UIYamada UIv1.6.4

NumberInput

NumberInput is a component used to obtain numeric input from the user.

Source@yamada-ui/number-input

If you are not using FormControl, set aria-label or aria-labelledby to NumberInput.

<NumberInput aria-label="Age" />
Copied!
<VStack gap="sm">
<Text as="h3" id="label">
Age
</Text>
<NumberInput aria-labelledby="label" />
</VStack>
Copied!

For example, if the day of the week is represented by a number and the value of aria-valuenow is not user-friendly, set aria-valuetext to a human-readable string such as "Monday".

const weekday = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
]
return (
<NumberInput
getAriaValueText={(value) => weekday[Number(value)]}
max={6}
min={0}
/>
)
Copied!

Keyboard Navigation

KeyDescriptionState
ArrowUpIncreases the value based on the step value.-
ArrowDownDecreases the value based on the step value.-
HomeSets the value to min.-
EndSets the value to max.-

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
NumberInputrole="group"Indicates that it is a group.
NumberInputField Internalrole="spinbutton"Indicates that it is a spin button.
aria-valueminSets the min value. Default is Number.MIN_SAFE_INTEGER.
aria-valuemaxSets the max value. Default is Number.MAX_SAFE_INTEGER.
aria-valuenowSets the current value.
aria-valuetextSets the current value.
NumberIncrementStepper Internalaria-labelSets "Increase".
NumberDecrementStepper Internalaria-labelSets "Decrease".

Edit this page on GitHub

PreviousInputNextPasswordInput