nyuchimzizi
Mzizi — an open-architecture project of the Bundu Foundation, operated and developed by Nyuchi. Built on the Five African Minerals palette.
Built by Nyuchi Africav4.0.39
Formatted price with currency, original price, and discount badge.
View the full component source code below.
import * as React from "react"
import { cn } from "@/lib/utils"
function PriceDisplay({
amount,
currency = "USD",
originalAmount,
discount,
className,
...props
}: {
amount: number
currency?: string
originalAmount?: number
discount?: string
} & React.ComponentProps<"div">) {
const formatter = new Intl.NumberFormat(undefined, { style: "currency", currency })
return (
<div
data-slot="price-display" data-portal="https://design.nyuchi.com/components/price-display"
className={cn("flex flex-wrap items-baseline gap-2", className)}
{...props}
>
<span className="text-2xl font-bold text-foreground">{formatter.format(amount)}</span>
{originalAmount != null && originalAmount > amount && (
<span className="text-sm text-muted-foreground line-through">
{formatter.format(originalAmount)}
</span>
)}
{discount && (
<span className="rounded-full bg-[var(--status-success, var(--color-malachite, #64FFDA))]/15 px-2 py-0.5 text-xs font-medium text-[var(--status-success, var(--color-malachite, #64FFDA))]">
{discount}
</span>
)}
</div>
)
}
export { PriceDisplay }
npx shadcn@latest add https://mzizi.dev/api/v1/ui/price-displayFetch this component's metadata and source code from the registry API.
/api/v1/ui/price-displaycomponents/ui/price-display.tsx