Pricing

Plan cards and a plan picker for lit-material: prices, features, the current plan, monthly or yearly billing.

  • 7.6 KB gzipped
  • @lit-material/pricing 1.8.0
  • Renders on the server

Example

Install

npm install @lit-material/pricing @lit-material/tokens
import "@lit-material/pricing";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-plan-card>

One plan: name, price, what it includes and an action. Marks the plan the reader is on (current) and the one to suggest (recommended) in words, not only by colour. Use it alone, or let lit-material-plan-picker lay several out from data.

Properties

PropertyAttributeTypeDefaultDescription
namenamestring""The plan's name.
descriptiondescriptionstring""One line under the name: who it's for.
pricepricestring""The price as it should read, formatted by the app: "$12", "Free", "Custom".
periodperiodstring""After the price: "per seat / month".
priceNoteprice-notestring""A line under the price: "billed yearly", "2 months free".
featuresfeaturesstring[][]What the plan includes, one entry per line.
currentcurrentbooleanfalseThe plan the reader is on.
recommendedrecommendedbooleanfalseThe plan to suggest. current wins when both are set.
headingLevelheading-levelnumber3Level of the name's heading, so cards fit the page's outline.

Slots

SlotDescription
defaultExtra content under the features, e.g. a limits table or a note.
actionThe plan's button, e.g. "Upgrade" or "Contact sales".

CSS parts

PartDescription
cardThe outlined box.
badgeThe "Current plan" / "Recommended" label.
priceThe price line.
featuresThe feature list.

CSS custom properties

PropertyDescription
--lit-material-plan-card-shapeCorner radius (default --md-sys-shape-corner-large).

<lit-material-plan-picker>

Plans side by side from data, for a pricing page or an account's plan page: a Monthly / Yearly switch when any plan has both prices, one lit-material-plan-card per plan, and a button per plan. The picker only reports the choice: open the checkout, confirm or change the plan in the lit-material-plan-select handler.

Properties

PropertyAttributeTypeDefaultDescription
plansplansPlan[][]
periodperiodBillingPeriod"monthly"The billing period shown.
periodNoteperiod-notestring""Next to the switch, e.g. "Yearly: 2 months free".
headingLevelheading-levelnumber3Level of each plan name's heading.

Events

EventDescription
lit-material-period-changeThe billing period switched; detail is { period }.
lit-material-plan-selectA plan's button was pressed; detail is { plan, period }.

CSS parts

PartDescription
switchThe Monthly / Yearly switch.
plansThe grid of cards.

CSS custom properties

PropertyDescription
--lit-material-plan-picker-min-card-widthNarrowest card before the grid wraps (default 240px).

Source on GitHub npm