DocsComponentsCommerce
OrderSummary
React example follows below.
ts
import { OrderSummary } from "@grassroot/ui-react"; const orderItems = [ { id: "seed", name: "Heirloom seed packet", price: 1800, quantity: 2, variant: "Tomato / Brandywine" }, { id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },]; <OrderSummary items={orderItems} shipping={800} taxRate={0.2} discount={500} onCheckout={() => {}} />ts
<script setup lang="ts">import { OrderSummary } from "@grassroot/ui-vue"; const orderItems = [ { id: "seed", name: "Heirloom seed packet", price: 1800, quantity: 2, variant: "Tomato / Brandywine" }, { id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },];</script> <template> <OrderSummary :items="orderItems" :shipping="800" :tax-rate="0.2" :discount="500" @checkout="undefined" /></template>ts
import { Component } from "@angular/core";import { GrassrootOrderSummary } from "@grassroot/ui-angular"; @Component({ selector: "app-example", standalone: true, imports: [GrassrootOrderSummary], template: ` <grassroot-order-summary [items]="orderItems" [shipping]="800" [taxRate]="0.2" [discount]="500" (checkout)="undefined" /> `,})export class ExampleComponent { readonly orderItems = [ { id: "seed", name: "Heirloom seed packet", price: 1800, quantity: 2, variant: "Tomato / Brandywine" }, { id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 }, ];}ts
<script lang="ts"> import { OrderSummary } from "@grassroot/ui-svelte"; const orderItems = [ { id: "seed", name: "Heirloom seed packet", price: 1800, quantity: 2, variant: "Tomato / Brandywine" }, { id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 }, ];</script> <OrderSummary items={orderItems} shipping={800} taxRate={0.2} discount={500} onCheckout={() => {}}/>ts
import { OrderSummary } from "@grassroot/ui-solid"; const orderItems = [ { id: "seed", name: "Heirloom seed packet", price: 1800, quantity: 2, variant: "Tomato / Brandywine" }, { id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },]; export function Example() { return ( <> <OrderSummary items={orderItems} shipping={800} taxRate={0.2} discount={500} onCheckout={() => {}} /> </> );}Installation
bash
pnpm dlx grassroot add ui/order-summarybash
npx grassroot@latest add ui/order-summarybash
yarn dlx grassroot add ui/order-summarybash
bunx grassroot add ui/order-summaryAPI Reference
| Prop | Type | Default |
|---|---|---|
itemsrequired | CartItem[] | — |
currency | string | undefined | "USD" |
shipping | number | undefined | — |
taxRate | number | undefined | — |
discount | number | undefined | — |
totalsPrecomputed totals; overrides the items/options computation. | OrderTotals | undefined | — |
onCheckout | (() => void) | undefined | — |
checkoutLabel | string | undefined | "Checkout" |
childrenSlot below the rows — typically a CouponInput. | React.ReactNode | — |
className | string | undefined | — |