SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

On this page

QuantityStepper

A − count + control for how many of something a cart holds.

2
1
View code
tsx
<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.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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.

PropTypeRequiredDescription
actionstringYesWhere the form posts.
valuenumberYesThe count now.
namestringNoThe field the new count posts as. @default "qty"
maxnumberNoThe most the count may reach; + is disabled there. @default 99
fieldsRecord<string, string>NoHidden fields the post carries, such as the line's index and the page to return to.
labelsLabelsYes

Also accepts everything in Omit<TagProps<"form">, "children" | "method">.

@sdxc/ui

Can’t find it? Contact us