PollarPollar
SDK Reference

Theming

Every modal in @pollar/react and the <WalletButton> read their colors, corners and stacking order from public CSS custom properties (--pollar-*). You can set any of them from your own stylesheet.

Requires: @pollar/react 0.12.0 or later.


Where a value comes from

Each variable resolves from three sources. The first one that sets it wins:

  1. Your stylesheet. A rule in your app that sets the variable on a Pollar element.
  2. Dashboard Branding. The values configured in Build -> Branding, loaded by the SDK at startup.
  3. Theme defaults. The Light set. If your page has <html class="dark"> and Branding leaves the palette open (see Dark mode), the Dark set is used instead.

You only set what you want to change. Anything you leave out still comes from Branding, and then from the defaults.


Override from your stylesheet

Set the variables on the Pollar root elements:

.pollar-modal-card,
.pollar-wallet-wrapper,
.pollar-wallet-login-btn {
  --pollar-accent: #7c3aed;
  --pollar-btn-primary-fg: #ffffff;
  --pollar-buttons-border-radius: 12px;
}

.pollar-overlay {
  --pollar-overlay-z-index: 1000;
}
ElementWhat it is
.pollar-modal-cardThe card of every modal (login, KYC, send, swap, ramp, history, ...)
.pollar-wallet-wrapperThe signed-in <WalletButton> and its dropdown
.pollar-wallet-login-btnThe signed-out <WalletButton>
.pollar-overlayThe backdrop behind a modal (only --pollar-overlay-z-index and --pollar-overlay-bg)

You don't need !important, and load order doesn't matter: the SDK declares its own values with zero specificity, so any selector with a class wins.

Set them on these elements, not on :root or body. Each Pollar root declares the variables itself, and a value declared on an element takes precedence over one inherited from :root. The two font variables are the exception: the SDK doesn't declare them, so they also work from :root.

To theme a single modal, target its own class. Each card has one next to .pollar-modal-card, for example .pollar-modal (login), .pollar-send-modal, .pollar-swap-modal, .pollar-ramp-modal or .pollar-hist-modal:

.pollar-send-modal {
  --pollar-modal-border-radius: 0px;
}

Dark mode

The SDK picks the palette like this:

  • Branding theme Dark: dark palette, always.
  • Branding theme Light with no Background or Text color: light palette. If your page has <html class="dark">, the modals switch to the dark palette, so they follow a Tailwind-style dark toggle without extra code.
  • Branding sets a Background or Text color: that palette is pinned, and html.dark does not change it.

For a pinned palette, or if your app marks dark mode in some other way, set the variables yourself:

html.dark .pollar-modal-card,
html.dark .pollar-wallet-wrapper {
  --pollar-bg: #0b0b0f;
  --pollar-text: #f4f4f5;
  --pollar-border: #27272a;
  --pollar-muted: #a1a1aa;
  --pollar-input-bg: #18181b;
}

[data-theme='dark'] .pollar-modal-card {
  --pollar-bg: #0b0b0f;
  --pollar-text: #f4f4f5;
}

Variable reference

VariableBranding settingDefault (light / dark)What it styles
--pollar-accentAccent#005db4Primary button fill, focus rings, spinners, active tabs, switches
--pollar-btn-primary-fgfollows Accent#ffffff or #111827Primary button label. The SDK picks the one readable on the accent, so set it whenever you override --pollar-accent.
--pollar-btn-secondary-bgButtonsnot setSecondary buttons: wallet, social and provider entries, back/cancel buttons, inline actions. Not set: the filled ones use --pollar-input-bg and the outlined ones stay transparent.
--pollar-btn-secondary-fgfollows Buttonsnot setSecondary button label. Set it together with --pollar-btn-secondary-bg.
--pollar-bgBackground#ffffff / #1a1a1aModal card and dropdown background
--pollar-textText#111827 / #ffffffBody text
--pollar-borderblended from Background + Text#e5e7eb / #374151Card, input and divider borders
--pollar-mutedblended from Background + Text#6b7280 / #9ca3afSecondary text, hints, captions
--pollar-input-bgblended from Background + Text#f9fafb / #374151Inputs and filled secondary buttons
--pollar-error-bgtheme only#fef2f2 / #2a1515Error banners
--pollar-error-bordertheme only#fecaca / #7f1d1dError banner border
--pollar-error-texttheme only#dc2626 / #f87171Error text and destructive actions
--pollar-success-texttheme only#16a34a / #4ade80Success states
--pollar-modal-border-radiusCorners -> Modal16pxModal card corners
--pollar-buttons-border-radiusCorners -> Buttons6pxButton corners, including <WalletButton>
--pollar-overlay-z-indexStacking order50Stacking order of the modal overlay. Set it on .pollar-overlay.
--pollar-overlay-bgnonergba(0, 0, 0, 0.5)Backdrop behind a modal. Set it on .pollar-overlay.
--pollar-buttons-heightnone44pxHeight of the full-width buttons
--pollar-input-heightnone44pxHeight of text inputs
--pollar-input-border-radiusCorners > Buttonsvar(--pollar-buttons-border-radius)Input corners. Inputs sit in the same column as the buttons, so they follow the button radius unless you set this
--pollar-card-border-radiusnone10pxInner cards and list items
--pollar-modal-paddingnone1.75rem; 2rem on the login modal and the ramp widgetPadding of the modal card
--pollar-modal-heading-sizenone1.375remLogin modal heading
--pollar-modal-subtitle-sizenone0.9remSubtitles of the login, KYC, ramp and requirement form modals
--pollar-font-familynonenot set: your page's fontEvery text, button and input in the modals and <WalletButton>
--pollar-font-family-monononeui-monospace, SFMono-Regular, Menlo, monospaceAddresses, hashes, codes and XDR

"Blended" means that when Branding sets a Background or Text color, the SDK mixes the border, secondary text and input fill from those two colors, so they match the custom pair. With neither set, they come from the theme.

Not affected by the variables

  • The Google and GitHub sign-in buttons keep their providers' brand styling (their corners still follow --pollar-buttons-border-radius).
  • The QR code in Receive and the KYC provider frame stay on white, so they remain readable.
  • The card artwork in the Card modal.

Custom templates

If you render the *Template components yourself, pass theme, accentColor and styleOverrides the way the live components do. modalChrome(usePollar().styles) returns all three. To theme your own markup the same way, put one of the root classes above on it and spread buildModalCssVars(theme, accentColor, styleOverrides) into its style.

buildModalCssVars writes the Branding values under private --pollar-brand-* names. Don't set or read those in your CSS: they are the input to the public variables above, and they may change between versions.

On this page

Was this helpful?