Skip to content

Overview

Input Number is a form entry component, where users can enter a number to submit.

Input Number can limit the number of characters with maxLength and minLength, as well as limit the values with its min and max properties.

Usage

  • Number submissions in forms

Sample

Accessibility

Keyboard navigation

KeyFunction
TabMoves focus in and out of the component.
Tab and ShiftMoves focus in and out of the component.
EscWhen clearable is true, clears the component's value.

API reference

Properties

PropertyAttributeDescriptionTypeDefault
alignmentalignmentSpecifies the text alignment of the component's value.Alignment"start"
autocompleteautocompleteSpecifies the type of content to autocomplete, for use in forms. Read the native attribute's documentation on MDN for more info.AutoFill
clearableclearableWhen true and the component has a value, a clear button is displayed.booleanfalse
disableddisabledWhen true, prevents interaction and decreases the component's opacity.booleanfalse
formformSpecifies the id of the component's associated form. When not set, the component is associated with its ancestor form element, if one exists.string
groupSeparatorgroup-separatorWhen true, number values are displayed with a group separator corresponding to the language and country format.booleanfalse
iconiconSpecifies an icon to display.IconName | boolean
iconFlipRtlicon-flip-rtlWhen true and the element direction is right-to-left ("rtl"), flips the components icon`.booleanfalse
integerintegerWhen true, restricts the component to integer numbers only and disables exponential notation.booleanfalse
labellabelSpecifies an accessible label for the component's button or hyperlink.string
labelTextlabel-textSpecifies the component's label text.string
loadingloadingWhen true, displays a busy indicator.booleanfalse
maxmaxWhen the component resides in a form, specifies the maximum value.number
maxLengthmax-length
deprecatedin v3.0.0, removal target v6.0.0 - This property has no effect on the component.
When the component resides in a form, specifies the maximum length of text for the component's value.
number
messageOverridesOverrides individual strings used by the component.Record<string, unknown> | undefined
minminWhen the component resides in a form, specifies the minimum value.number
minLengthmin-length
deprecatedin v3.0.0, removal target v6.0.0 - This property has no effect on the component.
When the component resides in a form, specifies the minimum length of text for the component's value.
number
namenameSpecifies the name of the component. Required to pass the component's value on form submission.string
numberButtonTypenumber-button-typeSpecifies the placement of the buttons.InputPlacement"vertical"
numberingSystemnumbering-systemSpecifies the Unicode numeral system used by the component for localization.NumberingSystem
placeholderplaceholderSpecifies the component's placeholder text.string
prefixTextprefix-textSpecifies text to display at the start of the component.string
readOnlyread-onlyWhen true, the component's value can be read, but cannot be modified.booleanfalse
requiredrequiredWhen true and the component resides in a form, the component must have a value in order for the form to submit.booleanfalse
scalescaleSpecifies the size of the component.Scale"m"
statusstatusSpecifies the input field's status, which determines message and icons.Status"idle"
stepstepSpecifies the granularity that the component's value must adhere to.number | "any"
suffixTextsuffix-textSpecifies text to display at the end of the component.string
validationIconvalidation-iconSpecifies the validation icon to display under the component.IconName | boolean
validationMessagevalidation-messageSpecifies the validation message to display under the component.string
validityread-onlyThe component's current validation state.MutableValidityState
valuevalueThe component's value.string

Slots

NameDescription
actionA slot for positioning a calcite-action or other interactive content adjacent to the component.
label-contentA slot for rendering content next to the component's labelText.

Styles

NameDescription
--calcite-input-actions-background-colorSpecifies the background color of the component's clearable and number-button-type elements.
--calcite-input-actions-background-color-hoverSpecifies the background color of the component's clearable and number-button-type elements when hovered.
--calcite-input-actions-background-color-pressSpecifies the background color of the component's clearable and number-button-type elements when pressed.
--calcite-input-actions-icon-colorSpecifies the icon color of the component's clearable and number-button-type elements.
--calcite-input-actions-icon-color-hoverSpecifies the icon color of the component's clearable and number-button-type elements when hovered.
--calcite-input-actions-icon-color-pressSpecifies the icon color of the component's clearable and number-button-type elements when pressed.
--calcite-input-loading-background-colorWhen loading, specifies the background color of the component's loading element.
--calcite-input-loading-fill-colorWhen loading, specifies the fill color of the component's loading element.
--calcite-input-number-background-colorSpecifies the component's background color.
--calcite-input-number-border-colorSpecifies the component's border color.
--calcite-input-number-corner-radiusSpecifies the component's border radius.
--calcite-input-number-icon-colorSpecifies the component's icon color.
--calcite-input-number-heightSpecifies the component's height.
--calcite-input-number-placeholder-text-colorSpecifies the text color of the component's placeholder.
--calcite-input-number-text-colorSpecifies the component's text color.
--calcite-input-number-text-color-focusSpecifies the component's text color when focused.
--calcite-input-prefix-sizeWhen prefixText is provided, specifies the width of the component's prefix element.
--calcite-input-prefix-text-colorWhen prefixText is provided, specifies the text color of the component's prefix element.
--calcite-input-suffix-sizeWhen suffixText is provided, specifies the width of the component's suffix element.
--calcite-input-suffix-text-colorWhen suffixText is provided, specifies the text color of the component's suffix element.

Events

NameDescriptionBehavior
calciteInputNumberChangeFires each time a new value is typed and committed.bubblescomposed
calciteInputNumberInputFires each time a new value is typed.bubblescomposedcancelable

Methods

NameDescriptionSignature
componentOnReadyCreate a promise that resolves once component is fully loaded.componentOnReady(): Promise<this>
selectTextSelects the text of the component's value.selectText(): Promise<void>
setFocusSets focus on the component.setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.