# ItemOptionsDialog

> The dialog an item opens before it goes in the cart: its picture, name and description, its option groups, a quantity and an add button carrying the running price.

```ts
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.

## Examples

```tsx
<ItemOptionsDialog id="item-tacos" action="/cart/add" title="Al pastor trio" base={1150} currency="USD" total="$11.50" submitLabel="Add to cart" closeLabel="Close">
	<OptionGroup name="tortilla" title="Tortilla" required choices={choices} />
</ItemOptionsDialog>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `id` | `string` | The dialog's id, which the item's button names with `commandfor`. |
| `action` | `string` | Where the form posts. |
| `title` | `string` |  |
| `description?` | `RemixNode` |  |
| `price?` | `RemixNode` | The item's price as the reader sees it, under the description. |
| `badges?` | `RemixNode` | Tags beside the price, such as dietary badges. |
| `media?` | `RemixNode` | A picture across the top, such as the dish. |
| `mediaBackground?` | `string` | The colour behind the picture. |
| `base` | `number` | The item's base price in minor units, which the running total starts from. |
| `currency` | `string` | The ISO 4217 code totals are written in. |
| `locale?` | `string` |  |
| `fields?` | `Record<string, string>` | Hidden fields the post carries, such as the item id and the page to return to. |
| `children?` | `RemixNode` | The OptionGroups. |
| `quantity?` | `{ label: string; name?: string; max?: number }` | A quantity field; omitted, the item is added one at a time. |
| `notice?` | `RemixNode` | A note above the add button, such as a warning that the cart will be replaced. |
| `submitLabel` | `RemixNode` | The 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. |
| `total` | `string` | The total the button shows before any pick, already formatted. |
| `disabled?` | `boolean` | Keeps the item from being added, such as while the shop is closed. |
| `closeLabel` | `string` | The close button's name, such as "Close". |

