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>
);
}As a link
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.
| Key | English | Arabic |
|---|---|---|
view | View proof | شوف الإثبات |
download | Download receipt | حمّل الإيصال |
receipt | View 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
- Control (
a.kit-prooforbutton.kit-proof): inline-flex, padding 6px 12px,--rasp-50fill,--rasp-100border,--rasp-d12.5px 700 text, pill. - Icon:
file, 14px. - Text: per
kind.
Variants
kind | Text (en / ar) | Behaviour |
|---|---|---|
'view' (default) | View proof / شوف الإثبات | Opens |
'receipt' | View receipt / شوف الإيصال | Opens (not saved) |
'download' | Download receipt / حمّل الإيصال | Link with download={fileName ?? ''} |
| Target | Element |
|---|---|
safe href | <a target="_blank" rel="noreferrer noopener"> |
onOpen only (or unsafe href) | <button type="button"> |
States
| State | Trigger | Look |
|---|---|---|
| Hover | pointer | Fill --rasp-100 |
| Focus-visible | Tab | Shared kit focus ring |
| Touch | ≤1024px | 36px min height |
| Nothing to open | no safe href and no onOpen | Renders 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
contextin tables. - Prefer
onOpenwith a modal for images;hreffor 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.
Related
ProofList: a list of proofs with amounts.ButtonLink: a general link-button (download,external).ReceiptCard: a full receipt.
See also: Icon · Avatar · AvatarStack · Button
Source
src/kit/primitives/ProofButton.tsx (line 36) on GitHub.