Skip to content

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.

PropTypeDefaultDescription
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.
optionsProductTypeOption[]PRODUCT_TYPE_OPTIONSOverride the taxonomy. Defaults to `PRODUCT_TYPE_OPTIONS`.
rank(options: ProductTypeOption[], query: string) => ProductTypeOption[]rankProductTypesRanking 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 | nullsuggestProductType"Did you mean…" strategy, consulted only when `rank` returns nothing.
initialSearchstring""Seeds the search field so the results / empty / suggestion states are static stories.
searchstring—Fully controlled search value. Wins over `initialSearch` when supplied.
onSearchChange(value: string) => void—Undocumented — add TSDoc to the prop in the library.
placeholderIndexnumber0Which ghost placeholder to show. Fixed, not animated — see `PLACEHOLDER_ROTATION`.
placeholdersstring[]PLACEHOLDER_ROTATIONUndocumented — add TSDoc to the prop in the library.
autoFocusSearchbooleantrueAutofocus the search field. Turn off when several modals share a story.
closeOnSelectbooleantrueClose the dialog after a selection. Off keeps a gallery story open.
titlestring"Add a product"Undocumented — add TSDoc to the prop in the library.
heightnumber460Fixed dialog height, in px.
classNamestring—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.