CLI previewInstall commands shown on this site are not released yet.

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-summary
bash
npx grassroot@latest add ui/order-summary
bash
yarn dlx grassroot add ui/order-summary
bash
bunx grassroot add ui/order-summary

API Reference

OrderSummaryProps
PropTypeDefault
itemsrequiredCartItem[]
currencystring | undefined"USD"
shippingnumber | undefined
taxRatenumber | undefined
discountnumber | undefined
totalsPrecomputed totals; overrides the items/options computation.OrderTotals | undefined
onCheckout(() => void) | undefined
checkoutLabelstring | undefined"Checkout"
childrenSlot below the rows — typically a CouponInput.React.ReactNode
classNamestring | undefined