Store
Add product type modal
The six-card product type chooser, with search and a suggestion when nothing matches.
Available
Ports as-is
Examples
Rendered live from the maintained Storybook story. Lantern stores only the story id and embeds Storybook rather than duplicating the component or its demo.
Add product type modal
Rendered live from Storybook
Storybook must be running for this to load — bun run start:storybook from the monorepo root, or set NEXT_PUBLIC_STORYBOOK_URL to a deployed instance.
Props
The component's public API, read from its TypeScript source. Descriptions come from TSDoc on the prop, so this table cannot drift from the component.
| Prop | Type | Default | Description |
|---|---|---|---|
open* | boolean | — | Undocumented — add TSDoc to the prop in the library. |
onOpenChange* | (open: boolean) => void | — | Undocumented — add TSDoc to the prop in the library. |
onSelectType* | (type: ProductKindType) => void | — | Undocumented — add TSDoc to the prop in the library. |
options | ProductTypeOption[] | PRODUCT_TYPE_OPTIONS | Override the taxonomy. Defaults to `PRODUCT_TYPE_OPTIONS`. |
rank | (options: ProductTypeOption[], query: string) => ProductTypeOption[] | rankProductTypes | Ranking strategy. Injected rather than hard-wired so a story can pin an exact result set — including the empty one — without depending on the scoring heuristic staying put. |
suggest | (options: ProductTypeOption[], query: string) => ProductTypeOption | null | suggestProductType | "Did you mean…" strategy, consulted only when `rank` returns nothing. |
initialSearch | string | "" | Seeds the search field so the results / empty / suggestion states are static stories. |
search | string | — | Fully controlled search value. Wins over `initialSearch` when supplied. |
onSearchChange | (value: string) => void | — | Undocumented — add TSDoc to the prop in the library. |
placeholderIndex | number | 0 | Which ghost placeholder to show. Fixed, not animated — see `PLACEHOLDER_ROTATION`. |
placeholders | string[] | PLACEHOLDER_ROTATION | Undocumented — add TSDoc to the prop in the library. |
autoFocusSearch | boolean | true | Autofocus the search field. Turn off when several modals share a story. |
closeOnSelect | boolean | true | Close the dialog after a selection. Off keeps a gallery story open. |
title | string | "Add a product" | Undocumented — add TSDoc to the prop in the library. |
height | number | 460 | Fixed dialog height, in px. |
className | string | — | Undocumented — add TSDoc to the prop in the library. |
Reference
Transcribed from the component audit. If this disagrees with the source, the source is right.
- Source
src/components/store/AddProductTypeModal.tsx- Portability
- Copies across unchanged — only the utils import path moves.
- Notes
- Exports ProductKindType, which the whole editor tree imports — port it early.