Styling the admin view
Make the payments admin view match your product with class names, CSS variables, labels and row actions, and what it does and does not do for security.
@umohpyro/better-auth-nuvion/react ships a payments table with leg progress, a Retry button on partial payments and a button that reconciles stuck transfers. It renders plain elements with class names and no inline styles, so you decide how it looks and it works under a strict Content Security Policy. react is an optional peer dependency.
import { PaymentsAdmin } from "@umohpyro/better-auth-nuvion/react";
import "@umohpyro/better-auth-nuvion/react.css"; // optional default look
<PaymentsAdmin api={authClient.nuvion} organizationId={orgId} />Without the stylesheet the view is unstyled HTML, which is the right starting point for your own design system.
Three ways to style it
1. The default look, with your colours
react.css is optional. Every rule in it has zero specificity (:where), so any rule of yours wins without !important. Change the look with variables:
.payments-admin {
--pay-ok: #0a7d3c;
--pay-bad: #a11d1d;
--pay-radius: 999px;
--pay-cell-y: 14px;
}| Variable | Controls | Default |
|---|---|---|
--pay-border | Borders of cells and buttons | currentColor at 18% |
--pay-hover | Row and button hover background | currentColor at 8% |
--pay-ok | settled and refunded text | #1f7a4a (dark: #6fd69b) |
--pay-bad | partial, refund_partial and error text | #b42323 (dark: #ff9b94) |
--pay-focus | Focus ring on buttons | #d3166a (dark: #ff77ae) |
--pay-radius | Button corner radius | 8px |
--pay-font-size | Table and button text | 14px |
--pay-cell-y, --pay-cell-x | Cell padding | 10px, 12px |
--pay-button-y, --pay-button-x | Button padding | 6px, 12px |
The stylesheet follows prefers-color-scheme, a .dark class or data-theme="dark" on any ancestor, and the matching .light or data-theme="light". Status colours meet 4.5:1 on a white or near-black page.
2. Your own CSS
Skip the stylesheet and target the classes, or the data-status attribute that rows and status cells carry:
.payments-table__status[data-status="settled"] { color: seagreen; }
.payments-table__status[data-status="partial"] { color: crimson; }
.payments-table__status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 8px; }3. Tailwind or a design system
unstyled drops the default class names so only yours apply, and classNames takes one string per part:
<PaymentsAdmin
api={authClient.nuvion}
organizationId={orgId}
unstyled
classNames={{
root: "space-y-3",
toolbar: "flex gap-2",
button: "rounded-md border px-3 py-1.5 text-sm hover:bg-muted disabled:opacity-50",
table: "w-full text-sm",
th: "p-2 text-left font-medium border-b",
td: "p-2 border-b",
status: "font-semibold data-[status=partial]:text-red-600 data-[status=settled]:text-green-700",
}}
/>Without unstyled, your class names are added after the defaults.
Parts
Each key of classNames is one part. The default class applies unless unstyled is set.
| Part | Default class | Element |
|---|---|---|
root | payments-admin | section around everything |
toolbar | payments-admin__toolbar | div holding the two buttons |
button | payments-admin__button | every button (toolbar and Retry) |
error | payments-admin__error | p role="alert" with a server error |
tableWrap | payments-table | div around the table (the scroll container) |
table | payments-table__table | table |
th, tr, td | payments-table__th, __tr, __td | header cell, row, cell |
time | payments-table__time | time in the Created cell |
reference | payments-table__reference | code with the payment reference |
status | payments-table__status | the Status cell (also has data-status) |
retry | payments-table__retry | the Retry button (also has the button class) |
empty | payments-table__empty | p shown when there are no payments |
data-status is one of the payment statuses on the row and on the Status cell.
Props
PaymentsAdmin fetches and refreshes by itself. PaymentsTable is the same table for data you load yourself (payments, onRetry, busyId). Both take:
| Prop | Type | Purpose |
|---|---|---|
classNames | Partial<Record<Part, string>> | Class names per part |
unstyled | boolean | Drop the default class names |
labels | Partial<Labels> | Replace any text, for wording or translation |
formatDate | (ms: number) => string | Replace the default 2026-11-19 09:30 (UTC) |
renderActions | (payment) => ReactNode | Your own buttons or links in each row's last cell |
PaymentsAdmin also takes api, organizationId and pollMs (refresh interval, default 15000).
<PaymentsAdmin
api={authClient.nuvion}
organizationId={orgId}
labels={{
reconcile: "Vérifier les virements bloqués",
retry: "Réessayer",
legsSummary: (done, total, failed) => `${done}/${total} terminés${failed ? `, ${failed} en échec` : ""}`,
}}
formatDate={(ms) => new Date(ms).toLocaleString("fr-FR")}
renderActions={(payment) => <a href={`/orders/${payment.id}`}>Open</a>}
/>labels has reconcile, refresh, retry, retrying, empty, loadFailed, requestFailed, table, created, reference, amount, status, legs and the legsSummary function.
Security
- No inline styles, no scripts, no raw HTML. Every value, including payment references and error messages that come from the server, is rendered as text by React. A reference like
<img onerror=...>shows as literal text. This is covered by a test. - Works under a strict CSP. Nothing needs
style-src 'unsafe-inline'. The stylesheet is a normal file you import. - Authorization is on the server. The view only calls the plugin's endpoints, which require an owner or admin of the organization. Hiding or restyling the view does not grant or remove access.
- No secrets in the browser. The view talks to your own Better Auth endpoints. The Nuvion key stays on the server.
renderActionsandclassNamesare your code. The view passes the payment row torenderActionsand nothing else, and it does not evaluate any string you give it.
Accessibility
Headers carry scope="col", the table has an aria-label (the table label), buttons are real button elements with type="button", busy buttons set aria-busy, each Retry button's accessible name includes the payment reference, and errors use role="alert". Status is text, never colour alone.
Hooks, listing and reconciliation
Run code when a payment changes state, charge customers without an organization, list and reconcile payments, call from a backend with an API key, and drop in the admin view.
Multi-tenant keys
Let each customer bring their own Nuvion key and webhook, using the plugin's fetch option and a small webhook proxy.