Docs Components Commerce

OrderSummary

React example follows below.
ts
const orderSummaryFixture = {
id: "order-summary",
items: [
{ id: "seed", name: "Heirloom seed packet", variant: "Tomato / Brandywine", price: 1800, quantity: 2 },
{ id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },
],
currency: "USD",
shipping: 800,
taxRate: 0.2,
discount: 500,
checkoutLabel: "Checkout",
} satisfies {
id: string;
items: Array<{ id: string; name: string; variant?: string; price: number; quantity: number }>;
currency: string;
shipping: number;
taxRate: number;
discount: number;
checkoutLabel: string;
};
import { OrderSummary } from "@grassroot/ui-react";
export default function OrderSummaryDemo() {
return (
<div>
<OrderSummary
items={orderSummaryFixture.items}
currency={orderSummaryFixture.currency}
shipping={orderSummaryFixture.shipping}
taxRate={orderSummaryFixture.taxRate}
discount={orderSummaryFixture.discount}
checkoutLabel={orderSummaryFixture.checkoutLabel}
onCheckout={() => {}}
/>
</div>
);
}
ts
<script setup lang="ts">
const orderSummaryFixture = {
id: "order-summary",
items: [
{ id: "seed", name: "Heirloom seed packet", variant: "Tomato / Brandywine", price: 1800, quantity: 2 },
{ id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },
],
currency: "USD",
shipping: 800,
taxRate: 0.2,
discount: 500,
checkoutLabel: "Checkout",
} satisfies {
id: string;
items: Array<{ id: string; name: string; variant?: string; price: number; quantity: number }>;
currency: string;
shipping: number;
taxRate: number;
discount: number;
checkoutLabel: string;
};
import { OrderSummary } from "@grassroot/ui-vue";
</script>
<template>
<div>
<OrderSummary
:items="orderSummaryFixture.items"
:currency="orderSummaryFixture.currency"
:shipping="orderSummaryFixture.shipping"
:tax-rate="orderSummaryFixture.taxRate"
:discount="orderSummaryFixture.discount"
:checkout-label="orderSummaryFixture.checkoutLabel"
@checkout="() => {}"
/>
</div>
</template>
ts
import { Component } from "@angular/core";
const orderSummaryFixture = {
id: "order-summary",
items: [
{ id: "seed", name: "Heirloom seed packet", variant: "Tomato / Brandywine", price: 1800, quantity: 2 },
{ id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },
],
currency: "USD",
shipping: 800,
taxRate: 0.2,
discount: 500,
checkoutLabel: "Checkout",
} satisfies {
id: string;
items: Array<{ id: string; name: string; variant?: string; price: number; quantity: number }>;
currency: string;
shipping: number;
taxRate: number;
discount: number;
checkoutLabel: string;
};
import { GrassrootOrderSummary } from "@grassroot/ui-angular";
@Component({
selector: "app-order-summary-demo",
standalone: true,
imports: [GrassrootOrderSummary],
template: `
<div>
<grassroot-order-summary
[items]="fixture.items"
[currency]="fixture.currency"
[shipping]="fixture.shipping"
[taxRate]="fixture.taxRate"
[discount]="fixture.discount"
[checkoutLabel]="fixture.checkoutLabel"
(checkout)="onCheckout()"
/>
</div>
`,
})
export class OrderSummaryDemoComponent {
protected readonly fixture = orderSummaryFixture;
protected onCheckout(): void {}
}
export default OrderSummaryDemoComponent;
ts
<script lang="ts">
import { OrderSummary } from "@grassroot/ui-svelte";
const orderSummaryFixture = {
id: "order-summary",
items: [
{ id: "seed", name: "Heirloom seed packet", variant: "Tomato / Brandywine", price: 1800, quantity: 2 },
{ id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },
],
currency: "USD",
shipping: 800,
taxRate: 0.2,
discount: 500,
checkoutLabel: "Checkout",
} satisfies {
id: string;
items: Array<{ id: string; name: string; variant?: string; price: number; quantity: number }>;
currency: string;
shipping: number;
taxRate: number;
discount: number;
checkoutLabel: string;
};
</script>
<div>
<OrderSummary
items={orderSummaryFixture.items}
currency={orderSummaryFixture.currency}
shipping={orderSummaryFixture.shipping}
taxRate={orderSummaryFixture.taxRate}
discount={orderSummaryFixture.discount}
checkoutLabel={orderSummaryFixture.checkoutLabel}
onCheckout={() => {}}
/>
</div>
ts
/** @jsxImportSource solid-js */
const orderSummaryFixture = {
id: "order-summary",
items: [
{ id: "seed", name: "Heirloom seed packet", variant: "Tomato / Brandywine", price: 1800, quantity: 2 },
{ id: "trowel", name: "Forged steel trowel", price: 3200, quantity: 1 },
],
currency: "USD",
shipping: 800,
taxRate: 0.2,
discount: 500,
checkoutLabel: "Checkout",
} satisfies {
id: string;
items: Array<{ id: string; name: string; variant?: string; price: number; quantity: number }>;
currency: string;
shipping: number;
taxRate: number;
discount: number;
checkoutLabel: string;
};
import { OrderSummary } from "@grassroot/ui-solid";
export default function OrderSummaryDemo() {
return (
<div>
<OrderSummary
items={orderSummaryFixture.items}
currency={orderSummaryFixture.currency}
shipping={orderSummaryFixture.shipping}
taxRate={orderSummaryFixture.taxRate}
discount={orderSummaryFixture.discount}
checkoutLabel={orderSummaryFixture.checkoutLabel}
onCheckout={() => {}}
/>
</div>
);
}

Installation

API Reference

Import

import { OrderSummary } from "@grassroot/ui-react";

Props

Prop
Type
Default
Requirement
Description
items
CartItem[]
—
required
—
currency
string | undefined
"USD"
optional
—
shipping
number | undefined
—
optional
—
taxRate
number | undefined
—
optional
—
discount
number | undefined
—
optional
—
totals
OrderTotals | undefined
—
optional
Precomputed totals; overrides the items/options computation.
onCheckout
(() => void) | undefined
—
optional
—
checkoutLabel
string | undefined
"Checkout"
optional
—
className
string | undefined
—
optional
—
Prop
items
Type
CartItem[]
Default
—
Requirement
required
Description
—
Prop
currency
Type
string | undefined
Default
"USD"
Requirement
optional
Description
—
Prop
shipping
Type
number | undefined
Default
—
Requirement
optional
Description
—
Prop
taxRate
Type
number | undefined
Default
—
Requirement
optional
Description
—
Prop
discount
Type
number | undefined
Default
—
Requirement
optional
Description
—
Prop
totals
Type
OrderTotals | undefined
Default
—
Requirement
optional
Description
Precomputed totals; overrides the items/options computation.
Prop
onCheckout
Type
(() => void) | undefined
Default
—
Requirement
optional
Description
—
Prop
checkoutLabel
Type
string | undefined
Default
"Checkout"
Requirement
optional
Description
—
Prop
className
Type
string | undefined
Default
—
Requirement
optional
Description
—

Events

EventPayload
onCheckout(() => void) | undefined

Content regions

  • children

Import

import { OrderSummary } from "@grassroot/ui-vue";

Props

Prop
Type
Default
Requirement
items
CartItem[]
—
required
currency
string | undefined
"USD"
optional
shipping
number | undefined
—
optional
taxRate
number | undefined
—
optional
discount
number | undefined
—
optional
totals
OrderTotals | undefined
—
optional
checkoutLabel
string | undefined
"Checkout"
optional
Prop
items
Type
CartItem[]
Default
—
Requirement
required
Prop
currency
Type
string | undefined
Default
"USD"
Requirement
optional
Prop
shipping
Type
number | undefined
Default
—
Requirement
optional
Prop
taxRate
Type
number | undefined
Default
—
Requirement
optional
Prop
discount
Type
number | undefined
Default
—
Requirement
optional
Prop
totals
Type
OrderTotals | undefined
Default
—
Requirement
optional
Prop
checkoutLabel
Type
string | undefined
Default
"Checkout"
Requirement
optional

Events

EventPayload
checkout[]

Content regions

  • default

Import

import { Component } from "@angular/core";
import { GrassrootOrderSummary } from "@grassroot/ui-angular";

Props

Prop
Type
Default
Requirement
items
CartItem[]
—
required
currency
string
"USD"
optional
shipping
number
—
optional
taxRate
number
—
optional
discount
number
—
optional
totals
OrderTotals
—
optional
checkoutLabel
string
"Checkout"
optional
Prop
items
Type
CartItem[]
Default
—
Requirement
required
Prop
currency
Type
string
Default
"USD"
Requirement
optional
Prop
shipping
Type
number
Default
—
Requirement
optional
Prop
taxRate
Type
number
Default
—
Requirement
optional
Prop
discount
Type
number
Default
—
Requirement
optional
Prop
totals
Type
OrderTotals
Default
—
Requirement
optional
Prop
checkoutLabel
Type
string
Default
"Checkout"
Requirement
optional

Events

EventPayload
checkoutvoid

Content regions

  • default

Import

import { OrderSummary } from "@grassroot/ui-svelte";

Props

Prop
Type
Default
Requirement
items
CartItem[]
—
required
currency
string
"USD"
optional
shipping
number
—
optional
taxRate
number
—
optional
discount
number
—
optional
totals
OrderTotals
—
optional
checkoutLabel
string
"Checkout"
optional
onCheckout
() => void
—
optional
className
string
—
optional
Prop
items
Type
CartItem[]
Default
—
Requirement
required
Prop
currency
Type
string
Default
"USD"
Requirement
optional
Prop
shipping
Type
number
Default
—
Requirement
optional
Prop
taxRate
Type
number
Default
—
Requirement
optional
Prop
discount
Type
number
Default
—
Requirement
optional
Prop
totals
Type
OrderTotals
Default
—
Requirement
optional
Prop
checkoutLabel
Type
string
Default
"Checkout"
Requirement
optional
Prop
onCheckout
Type
() => void
Default
—
Requirement
optional
Prop
className
Type
string
Default
—
Requirement
optional

Events

EventPayload
onCheckout() => void

Content regions

  • children

Import

import { OrderSummary } from "@grassroot/ui-solid";

Props

Prop
Type
Default
Requirement
items
CartItem[]
—
required
currency
string
"USD"
optional
shipping
number
—
optional
taxRate
number
—
optional
discount
number
—
optional
totals
OrderTotals
—
optional
onCheckout
() => void
—
optional
checkoutLabel
string
"Checkout"
optional
className
string
—
optional
Prop
items
Type
CartItem[]
Default
—
Requirement
required
Prop
currency
Type
string
Default
"USD"
Requirement
optional
Prop
shipping
Type
number
Default
—
Requirement
optional
Prop
taxRate
Type
number
Default
—
Requirement
optional
Prop
discount
Type
number
Default
—
Requirement
optional
Prop
totals
Type
OrderTotals
Default
—
Requirement
optional
Prop
onCheckout
Type
() => void
Default
—
Requirement
optional
Prop
checkoutLabel
Type
string
Default
"Checkout"
Requirement
optional
Prop
className
Type
string
Default
—
Requirement
optional

Events

EventPayload
onCheckout() => void

Content regions

  • children