DocsComponentsCommerce
Price
React example follows below.
ts
import { Price } from "@grassroot/ui-react"; <Price amount={3200} /><Price amount={8900} compareAt={10400} size="lg" /><Price amount={1800} currency="EUR" locale="de-DE" />ts
<script setup lang="ts">import { Price } from "@grassroot/ui-vue";</script> <template> <Price :amount="3200" /> <Price :amount="8900" :compare-at="10400" size="lg" /> <Price :amount="1800" currency="EUR" locale="de-DE" /></template>ts
import { Component } from "@angular/core";import { GrassrootPrice } from "@grassroot/ui-angular"; @Component({ selector: "app-example", standalone: true, imports: [GrassrootPrice], template: ` <grassroot-price [amount]="3200" /> <grassroot-price [amount]="8900" [compareAt]="10400" size="lg" /> <grassroot-price [amount]="1800" currency="EUR" locale="de-DE" /> `,})export class ExampleComponent {}ts
<script lang="ts"> import { Price } from "@grassroot/ui-svelte";</script> <Price amount={3200} /><Price amount={8900} compareAt={10400} size="lg" /><Price amount={1800} currency="EUR" locale="de-DE" />ts
import { Price } from "@grassroot/ui-solid"; export function Example() { return ( <> <Price amount={3200} /> <Price amount={8900} compareAt={10400} size="lg" /> <Price amount={1800} currency="EUR" locale="de-DE" /> </> );}Installation
bash
pnpm dlx grassroot add ui/pricebash
npx grassroot@latest add ui/pricebash
yarn dlx grassroot add ui/pricebash
bunx grassroot add ui/priceAPI Reference
| Prop | Type | Default |
|---|---|---|
amountrequiredCurrent price in minor units (e.g. cents). | number | — |
currencyISO 4217 currency code. | string | undefined | "USD" |
compareAtOriginal price in minor units — struck through when greater than `amount`. | number | undefined | — |
localeBCP-47 locale; defaults to the runtime locale. | string | undefined | — |
size | "sm" | "md" | "lg" | undefined | "md" |