Skip to content

Settings

Discount type modal

A dialog offering the three discount kinds a space can create, so an operator can pick one before entering the full editor.
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.

Discount 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
openboolean—Controlled open state. Supply with `onOpenChange`.
defaultOpenbooleanfalseUncontrolled open state — this is how the open-on-mount stories work.
onOpenChange(open: boolean) => void—Undocumented — add TSDoc to the prop in the library.
onSelect(kind: DiscountKind) => void—Fired with the chosen kind. The modal closes itself immediately after.
optionsDiscountKindOption[]DISCOUNT_KIND_OPTIONSOverride the option list — a space with no store hides the product-level kinds.
titleReact.ReactNode"Create a discount"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/settings/DiscountTypeModal.tsx
Portability
Copies across unchanged — only the utils import path moves.
Notes
Use it as the entry point to discount creation; selecting an option immediately closes the modal and hands the chosen kind onward, with no confirmation step. The option list is a prop, so a space without a store can be shown a shorter set of kinds without altering the component.