Skip to Content
BBRICKSv0.7.4
KitPrimitives

ProofButton

The v3 mock's .proof: a labelled pill with a file icon, replacing the bare "View proof" link. context names which proof ("ref 88412", a creator) for AT and the tooltip, so a table of them is never "View proof" × 10. Opens with onOpen (the proof modal) or follows href in a new tab. Inside a clickable row it never opens the row. kind="download" reads "Download receipt" and its link downloads the file (fileName). With neither a safe href nor onOpen there is nothing to open, so it renders nothing (a card top-up has no receipt).

import { ProofButton } from '@ergasti/bricks';

Examples

Open a proof

The "Transfer proof" button beside a payout; context makes its accessible name specific. Give href for a link instead of a button.

Code
import { useState } from 'react';
import { ProofButton } from '@ergasti/bricks';

function Open() {
  const [seen, setSeen] = useState(false);
  return (
    <div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
      <ProofButton context="ref 88412" onOpen={() => setSeen(true)} />
      {seen && <small>Proof opened</small>}
    </div>
  );
}

With href the proof opens as a link (in a new tab) instead of calling onOpen.

Code
import { ProofButton } from '@ergasti/bricks';

function Link() {
  return <ProofButton context="ref 88413" href="https://example.com/proofs/88413.pdf" />;
}

Download a receipt

kind="download" reads "Download receipt" and its link saves the file; fileName names it. Inside a clickable row it never opens the row.

Code
import { ProofButton } from '@ergasti/bricks';

function Download() {
  return <ProofButton kind="download" href="#receipt-88531" fileName="receipt-88531.pdf" context="ref 88531" />;
}

View a receipt

kind="receipt" reads "View receipt": the receipt opens (a modal through onOpen) and is not saved. Use it for a wallet entry's receipt shown in place; keep the default 'view' for a transfer proof, and 'download' when the file should be saved.

Code
import { useState } from 'react';
import { ProofButton } from '@ergasti/bricks';

function Receipt() {
  const [seen, setSeen] = useState(false);
  return (
    <div style={{ display: 'flex', gap: 12, alignItems: 'center', flexWrap: 'wrap' }}>
      <ProofButton context="ref 88412" onOpen={() => setSeen(true)} />
      <ProofButton kind="receipt" context="Top-up 12 Nov" onOpen={() => setSeen(true)} />
      {seen && <small>Opened</small>}
    </div>
  );
}

Props

Prop

Type

Labels

Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key proofButton, or with the component's own prop where it has one. A {name} is a value the component fills in.

proofButton
KeyEnglishArabic
viewView proofشوف الإثبات
downloadDownload receiptحمّل الإيصال
receiptView receiptشوف الإيصال

Design guidance

How the BRICKS design system uses ProofButton. Written in docs/content/components/ProofButton.md; the props above are read from the code, which wins where the two disagree.

A small raspberry pill with a file icon ("View proof", "Download receipt", "View receipt") that opens or downloads a payment document; use it in payout and ledger rows.

ProofButton is the v3 mock's .proof, replacing a bare "View proof" link. It opens a proof modal through onOpen, or follows a safe href in a new tab (downloading with kind="download"). context ("ref 88412") is added to its accessible name and tooltip, so a table of them is never "View proof" × 10. Inside a clickable row it stops the click, so it never opens the row. With neither a safe href nor onOpen there is nothing to open and it renders nothing (a card top-up has no receipt).

Anatomy

  1. Control (a.kit-proof or button.kit-proof): inline-flex, padding 6px 12px, --rasp-50 fill, --rasp-100 border, --rasp-d 12.5px 700 text, pill.
  2. Icon: file, 14px.
  3. Text: per kind.

Variants

kindText (en / ar)Behaviour
'view' (default)View proof / شوف الإثباتOpens
'receipt'View receipt / شوف الإيصالOpens (not saved)
'download'Download receipt / حمّل الإيصالLink with download={fileName ?? ''}
TargetElement
safe href<a target="_blank" rel="noreferrer noopener">
onOpen only (or unsafe href)<button type="button">

States

StateTriggerLook
HoverpointerFill --rasp-100
Focus-visibleTabShared kit focus ring
Touch≤1024px36px min height
Nothing to openno safe href and no onOpenRenders null

Usage

Past payouts table:

interface Payout { ref: string; date: string; amount: string }
const columns: DataColumn<Payout>[] = [
  { key: 'date', label: 'Date', render: (p) => p.date },
  { key: 'amount', label: 'Amount', align: 'end', render: (p) => <Money value={p.amount} /> },
  { key: 'proof', label: 'Proof', render: (p) => <ProofButton context={`ref ${p.ref}`} onOpen={() => console.log('proof', p.ref)} /> },
];

A ledger row with a downloadable receipt:

<ProofButton kind="download" href={entry.receiptUrl} fileName={`receipt-${entry.ref}.pdf`} context={entry.ref} />

Where it appears

  • Brand › Payments › Payouts › past payouts table ("Proof" column, opens the "Transfer proof" dialog) and the Payouts summary "proof attached".
  • Brand › Payments › Wallet and Motivation › gifts: the proof button after a paid total.
  • The "View receipt" / "Download receipt" kinds are library copy for ledger rows; the v3 mock only draws "View proof".
  • Screen: Payments › Wallet.

Guidelines

Do

  • Always pass context in tables.
  • Prefer onOpen with a modal for images; href for PDFs.

Don't

  • Don't render a placeholder when there's no proof; it already renders nothing.
  • Don't pass a blob: URL; it is not a safe href.

RTL and Arabic

  • Icon sits at the inline start; Arabic wording from the copy table.

Tokens

--rasp-50, --rasp-100, --rasp-d.

Accessibility

  • Name: the text, or "View proof · ref 88412" with context; the same string is the tooltip.
  • Link or button semantics match the behaviour; click does not bubble to the row.
  • Icon is hidden.

Found in the source

  • ARIA attributes set: aria-label.
  • Its tests cover: “a labelled pill with a file icon, named with which proof it is”; “opens on click, Enter and Space without opening the clickable row it sits in”.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Icon · Avatar · AvatarStack · Button

Source

src/kit/primitives/ProofButton.tsx (line 36) on GitHub.

On this page