Receipt

Slant / Media & motion

Numbered line items, dotted leaders and a total on a torn-edge receipt.

Demo

Usage

@tuttn/slant
import { Button, Receipt, Slant } from '@tuttn/slant'

<Receipt
  title="Field Supply"
  caption="Order 0042"
  description="Collected at the studio"
  items={[
    { id: 'notes', label: 'Field notes', value: '3 × $8' },
    { id: 'pencil', label: 'Graphite pencil', value: '$4' },
  ]}
  total="$28.00"
  footer={<Button onClick={saveReceipt}>Save receipt</Button>}
/>

// A paper receipt inside a darker page.
<Slant theme="paper">
  <Receipt title="Studio Pass" items={passItems} total="$32.00" />
</Slant>

Props

PropTypeDefaultDescription
titleReactNode—The receipt's heading and default accessible name.
captionReactNode—A short reference, date or category above the heading.
descriptionReactNode—
itemsreadonly ReceiptItem[]—Numbered lines, with optional values aligned at the end.
totalReactNode—A summary value beneath the lines.
totalLabelReactNodemessages.receiptTotalNames the summary value.
footerReactNode—Actions or a note below the summary.
…restOmit<HTMLAttributes<HTMLElement>, 'title' | 'children'>—className, style, aria attributes and the ref go on the root article.

Accessibility

  • The root is an article named by its heading; line items are an ordered list and the total is a description list.
  • Printed line numbers and dotted leaders are decorative. Footer buttons and links keep their normal keyboard behavior.

Paper, ink and a torn edge

Receipt presents a compact statement: an order, a ticket, a plan or a list of services. The numbered rows, dotted leaders and dashed rules use Slant's monospace type and theme tokens. The bottom edge is transparent, so any background beneath the receipt shows through the notches.

Content and actions

Pass stable id values with the items. Labels and values accept React content, and a row can omit its value. total adds a summary with totalLabel, which defaults to “Total”. Receipt displays the values you supply; it does not calculate prices or process payments. Use footer for a real button, link or supporting note.

Layout

The receipt fills its container. Labels and values wrap within narrow columns; long references can break instead of pushing the page sideways. Wrap it in a nested Slant root for a different paper and ink theme. Only the paper layer is masked, so action focus rings remain visible.