QuantityStepper
A − count + control for how many of something a cart holds.
View code
<QuantityStepper
action="/cart/line"
value={line.qty}
fields={{ line: String(index), back: "cart" }}
labels={{ fewer: `One fewer ${name}`, more: `One more ${name}`, remove: `Remove ${name}`, count: `${line.qty} of ${name}` }}
/>Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { QuantityStepper } from "@sdxc/ui/commerce";Renders the stepper as a pill-shaped form of two submit buttons around the count.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Where the form posts. |
value | number | Yes | The count now. |
name | string | No | The field the new count posts as. @default "qty" |
max | number | No | The most the count may reach; + is disabled there. @default 99 |
fields | Record<string, string> | No | Hidden fields the post carries, such as the line's index and the page to return to. |
labels | Labels | Yes |
Also accepts everything in Omit<TagProps<"form">, "children" | "method">.