SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

On this page

ItemOptionsDialog

The dialog an item opens before it goes in the cart.

Al pastor trio

Spit-roasted pork, charred pineapple, cilantro and onion.

$11.50

TortillaPick oneRequired
ExtrasOptional, up to 2
View code
tsx
<MenuItemCard dialog="item-al-pastor" name="Al pastor trio" price="$11.50" />
<ItemOptionsDialog
	id="item-al-pastor"
	action="/cart/add"
	title="Al pastor trio"
	description="Spit-roasted pork, charred pineapple, cilantro and onion."
	base={1150}
	currency="USD"
	total="$11.50"
	fields={{ item: "al-pastor" }}
	quantity={{ label: "Quantity" }}
	submitLabel={<>Add <span data-options-qty>1</span> to cart</>}
	closeLabel="Close"
>
	<OptionGroup name="tortilla" title="Tortilla" required requiredLabel="Required" choices={tortillas} />
	<OptionGroup name="extras" title="Extras" max={3} choices={extras} />
</ItemOptionsDialog>

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

Renders the dialog, its form and its OptionsLive island. Without script the form still posts every pick; the button shows the base total until the server prices it.

Props

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

PropTypeRequiredDescription
idstringYesThe dialog's id, which the item's button names with commandfor.
actionstringYesWhere the form posts.
titlestringYes
descriptionRemixNodeNo
priceRemixNodeNoThe item's price as the reader sees it, under the description.
badgesRemixNodeNoTags beside the price, such as dietary badges.
mediaRemixNodeNoA picture across the top, such as the dish.
mediaBackgroundstringNoThe colour behind the picture.
basenumberYesThe item's base price in minor units, which the running total starts from.
currencystringYesThe ISO 4217 code totals are written in.
localestringNo
fieldsRecord<string, string>NoHidden fields the post carries, such as the item id and the page to return to.
childrenRemixNodeNoThe OptionGroups.
quantity{ label: string; name?: string; max?: number }NoA quantity field; omitted, the item is added one at a time.
noticeRemixNodeNoA note above the add button, such as a warning that the cart will be replaced.
submitLabelRemixNodeYesThe add button's words before the price, such as "Add to cart". Put a <span data-options-qty>1</span> in it to show the quantity live.
totalstringYesThe total the button shows before any pick, already formatted.
disabledbooleanNoKeeps the item from being added, such as while the shop is closed.
closeLabelstringYesThe close button's name, such as "Close".
@sdxc/ui

Can’t find it? Contact us