SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

On this page

SortSelect

The order a product listing is sorted in, as a labelled native select that submits its form the moment the shopper picks an order.

View code
tsx
<SortSelect
	form="filters"
	name="sort"
	value={sort}
	label="Sort by"
	options={[
		{ value: "featured", label: "Featured" },
		{ value: "new", label: "Newest" },
		{ value: "price-asc", label: "Price: low to high" },
		{ value: "price-desc", label: "Price: high to low" },
	]}
/>

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 { SortSelect } from "@sdxc/ui/commerce";

Renders the label and select in a row, with a submit button that hides once script runs.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
namestringYesThe query field the order submits as, such as "sort".
valuestringYesThe order selected now.
optionsOption[]Yes
labelstringYesThe visible label, such as "Sort by".
formstringNoThe id of the form the select belongs to, when it sits outside that form.
submitLabelstringNoThe button that submits without script. @default "Apply"

Also accepts everything in Omit<TagProps<"div">, "children">.

@sdxc/ui

Can’t find it? Contact us