Shopware Design

Number Field

Source

Usage

Number Field is a numeric input control for values that should be numeric, such as quantities, counts, percentages, or other values that benefit from step-based input. Use it when min and max limits should guide valid input.

import { MtNumberField } from "@shopware-ag/meteor-component-library";

Examples

Disabled

Error

Hint

API reference

Props

PropTypeDefault
copyable
Toggles the copy function of the text field.
booleanfalse
error
An error in your business logic related to this field.
Record<string, any>null
label
A label for your text field. Usually used to guide the user what value this field controls.
stringnull
required
Determines if the field is required.
booleanfalse
is-inheritance-field
Determines if the field is inheritable.
booleanfalse
is-inherited
Toggles the inheritance visualization.
booleanfalse
help-text
A text that helps the user to understand what this field does.
stringnull
disabled
Determines if the field is disabled.
booleanfalse
placeholder
A placeholder text being displayed if no value is set.
string""
namestringnull
size
The size of the text field.
string"default"
model-value
The value of the text field. The value of the number field.
numbernull
disable-inheritance-toggle
Determines the active state of the inheritance toggle.
booleanfalse
copyable-tooltip
If set to true the tooltip will change on successful copy.
booleanfalse
max-length
If set to a value a character counter will be displayed.
numberundefined
id-suffixstring""
number-type
Defines if the number should be a floating point number or integer.
"float" | "int""float"
step
Defines the amount of which the number is increased or decreased per step.
numbernull
min
Defines the minimum value of the number.
numbernull
max
Defines the maximum value of the number.
numbernull
digits
Defines how many digits should be displayed after the decimal point.
number2
fill-digits
Defines if digits should be filled with zeros if the value is smaller than the minimum value.
booleanfalse
allow-empty
Defines if the field can be empty.
booleanundefined
number-align-end
Defines if the number should be aligned to the end of the input field.
booleanfalse
show-controls
Defines if the control arrows should be visible.
booleantrue
on-update:model-value((...args: any[]) => any) | undefined
on-change((...args: any[]) => any) | undefined
on-inheritance-remove((...args: any[]) => any) | undefined
on-inheritance-restore((...args: any[]) => any) | undefined
on-blur((...args: any[]) => any) | undefined
on-focus((...args: any[]) => any) | undefined
on-input-change((...args: any[]) => any) | undefined

Exposed

NameType
tComposerTranslation<{ en: { increaseButton: string; decreaseButton: string; }; de: { increaseButton: string; decreaseButton: string; }; }, "en" | "de", RemoveIndexSignature<{ [x: string]: LocaleMessageValue<VueMessageType>; }>, never, "increaseButton" | "decreaseButton", "increaseButton" | "decreaseButton">
currentValuestring | number
hasFocusboolean
rawUserInputstring | null
hasErrorboolean
hasDisabledInputboolean
realStepnumber
realMinimumnumber | null
realMaximumnumber | null
stringRepresentationstring
controlClasses{ "mt-field__controls--disabled": boolean; "mt-field__controls--has-error": boolean; "mt-field__controls--small": boolean; }
allowEmptyWithDefaultboolean
onInput((event: Event) => void) & ((event: Event) => void)

Best practices

Do
  • Use a clear label that explains what the number represents.
  • Configure step, min, and max when the range is known.
  • Choose the right numberType for integer or decimal input.
Don't
  • Do not use Number Field for values that are identifiers but look numeric.
  • Do not use it when users need to pick both a number and a unit together.
  • Do not hide important limits from users if the field enforces them.

Behavior

  • Number Field builds on the shared field base and adds numeric parsing, stepping, and optional arrow controls.
  • numberType, digits, fillDigits, and numberAlignEnd help tune how numeric values are entered and displayed.
  • showControls can show increase and decrease buttons for step-based adjustment.

Accessibility

  • Always provide a visible label that explains the meaning of the number.
  • Use help text when users need context about valid ranges, units, or rounding.
  • Make sure any min, max, or step behavior matches the expectations shown in the UI.
  • Text Field: when numeric-looking content should stay as plain text.