Selector de cantidad para e-commerce, una variante ligera de <mv-number-field>: mínimo 1, limitado automáticamente a las existencias, una leyenda “En stock” / “Solo quedan 3 en stock” / “Agotado” vinculada al campo, un mensaje y una sacudida al alcanzar el límite de existencias, un estado agotado deshabilitado que se reactiva al reponerse; variantes píldora y sutil para las líneas del carrito.
Agente de IA con el servidor MCP de Marvelous UI: install_components({ slugs: ["quantity"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).
Same as <mv-number-field> (submits an integer value).
min
number
1
Minimum quantity.
max
number
Commercial cap (e.g. 10 per order); combined with stock, the smaller one wins.
stock
number
Available stock: caps the value and drives the caption; 0 = out of stock (disabled).
low-stock
number
5
Threshold for the “Only n left in stock” caption.
caption
auto | none | text
auto
Automatic caption, none, or free text.
data-size
sm | md
Height (lg by default, sized to match an “Add to cart” button).
data-variant
pill | ghost
Rounded pill, or muted background without a border.
disabled / readonly / required
boolean
Form states.
Properties
Name
Tipo
Descripción
value
number | null
Quantity.
stock
number
Stock (assignable: restock).
inStock
boolean
Read-only.
strings
Partial<Record<string, string | { one, other }>>
Overrides for the default text (en-US): quantity (default accessible name), inStock, outOfStock, lastOne (stock of 1), onlyLeft (low stock, {n}, { one, other }), maxAvailable (shown at the stock limit, {n}, { one, other }), plus the number-field keys decrease, increase and valueMissing. App-wide translations: setStrings() from core/i18n.js, under the key "quantity". Can be set before the element is defined.
Inherits the APG Spinbutton pattern from <mv-number-field> (arrows, Page↑/↓, Home/End, “Decrease” / “Increase” buttons outside the tab order). Default name “Quantity”. The stock caption is linked via aria-describedby; the “Maximum quantity” message is announced (aria-live polite) when trying to exceed the stock. When out of stock, the field is disabled and empty (dash).