View fulldotdev/ui on GitHub

Price

A flexible price display component for showing pricing information.

Installation

npx shadcn@latest add @fulldev/price

Usage

import { Price, PriceUnit, PriceValue } from "@/components/ui/price"
<Price>
  <PriceValue price={99} />
  <PriceUnit>month</PriceUnit>
</Price>

Examples

Notes

  • Use compareAt to show the original price and automatic savings output. It only shows when it is higher than price, and 0 counts as a price.
  • Pass currency and locale when the default USD and en-US formatting are not correct for your project.
  • Pass discountLabel to put the savings badge in the page language. It comes before the discount, as in Save 20%.
  • Use showDiscount={false} when you want the strike-through price without the savings badge.

API Reference

See the GitHub source code for more information on props.