SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

PackageSavings

A bundle's price beside what its parts cost apart.

Flight + Hotel + Car

  • Return flights MRW ⇄ VLSLarkwing Air · EconomyBooked separately: $684
  • 5 nights at Hotel SaltmarshDouble room · breakfastBooked separately: $824
  • Compact car, 5 daysTallow RentBooked separately: $190
Package priceYou save $212

Booked separately: $1,698$1,486

2 travellers · taxes included
View code
tsx
<PackageSavings
	title="Flight + Hotel + Car"
	savings="You save $212"
	bundleLabel="Package price"
	bundlePrice="$1,486"
	bundleDetail="2 travellers · taxes included"
	separateTotal="$1,698"
	separateLabel="Booked separately"
	action={<Button>Book package</Button>}
>
	<PackageSavings.Part kind="flight" label="Return flights MRW ⇄ VLS" detail="Larkwing Air · Economy" price="$684" />
	<PackageSavings.Part kind="stay" label="5 nights at Hotel Saltmarsh" detail="Double room · breakfast" price="$824" />
	<PackageSavings.Part kind="car" label="Compact car, 5 days" detail="Tallow Rent" price="$190" />
</PackageSavings>

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

Renders the bundle: a <section> whose title and parts list sit over the bundled price under 32rem, and beside it from there. The parts total is struck through over the bundled price, and the saving is a success-toned badge beside it.

Composition

The parts the component publishes, each a static property of the host.

  • PackageSavings
  • PackageSavings.PartRenders one part of the bundle: its icon in a tinted square, its label and detail, and what it costs alone struck through at the end, led by the bundle's separateLabel when set.

Props

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

PropTypeRequiredDescription
titleRemixNodeNoWhat the bundle is, such as "Flight + Hotel + Car", over the parts.
savingsRemixNodeYesThe saving as a badge, such as "You save $212".
bundleLabelRemixNodeYesWhat the bundled price is, such as "Package price".
bundlePricestringYesThe bundled price, formatted, such as "$1,486".
bundleDetailRemixNodeNoWhat the price covers, such as "2 travellers · taxes included", under it.
separateTotalstringNoThe parts' prices added up, struck through above the bundled price, such as "$1,698".
separateLabelstringNoRead before every struck price, such as "Booked separately", since a strike-through is silent to most screen readers.
actionRemixNodeNoA booking button or link under the bundled price.
childrenRemixNodeYesThe PackageSavings.Part lines.

Also accepts everything in Omit<TagProps<"section">, "title">.

PackageSavings.Part

PropTypeRequiredDescription
kind"flight" | "stay" | "car" | "activity"Yes
iconRemixNodeNoA glyph in place of the kind's own.
labelRemixNodeYesWhat the part is, such as "Return flights MRW ⇄ VLS".
detailRemixNodeNoA second line, such as "Larkwing Air · Economy".
pricestringYesWhat the part costs booked alone, formatted, such as "$684"; drawn struck through.

Also accepts everything in Omit<TagProps<"li">, "children">.

Types

NameValuesWhat it decides
Kind"flight" | "stay" | "car" | "activity"What a part is, which picks its icon.
@sdxc/ui

Can’t find it? Contact us