Styling and branding

Styling and branding

The styling stack

From version 11, 3B Portals styles pages with Tailwind CSS and its own design system. No third party component library is loaded any more.

You style elements in the builder by applying utility and component classes, either through the style manager or by typing classes directly. The builder's selector escaper allows Tailwind classes containing slashes (for example w-1/2, bg-brand/10).

Themes

Two themes exist: light (default) and dark.

Where the theme is set How
Standard component The theme-type trait (Inherit page theme, Light or Dark). The component stamps data-theme on its wrapper.
Whole page or section Add data-theme="dark" to any element; everything inside it switches to the dark tokens.
Legacy values Theme names from earlier versions (emerald, lemonade, cmyk, black, pastel, wireframe, retro) fall back to light. Existing pages keep working; only the visual result changes.

Version 12.0.0 refreshes both default palettes. The light theme keeps plum primary actions with softer surfaces; the dark theme uses green primary actions on dark navy surfaces. Existing pages using default tokens adopt these colours after upgrading. Review branded pages in both themes.

Design tokens

The palette is expressed as CSS custom properties on the themed element. They inherit into every nested part of the page (including the shadow DOM of the chart and login components), so overriding them on a wrapper restyles everything inside.

Token Purpose Light default
--ui-surface Page canvas behind panels #f6f7fd
--ui-panel Cards, dialogs, inputs #ffffff
--ui-panel-muted Subtle fills (hover rows, disabled inputs) #eef0f8
--ui-line / --ui-line-strong Borders and dividers #e8e8ec / #bcbbc6
--ui-ink / --ui-ink-muted / --ui-ink-faint Text hierarchy #1f1c42 / #4f4d6b / #8e8ca3
--ui-brand / --ui-brand-hover / --ui-brand-soft / --ui-brand-content Primary actions, active states, text on brand #291334 / #3d1d4e / #f1ebf5 / #ffffff
--ui-accent / --ui-accent-content Highlight colour #fabe23 / #291334
--ui-ok, --ui-warn, --ui-danger, --ui-info (+ -soft) Status colours and their tinted backgrounds green / amber / red / blue

Version 12.0.0 also provides these CSS custom properties for branded sections and illustrations:

Token Purpose Light default
--ui-brand-strong Strong brand colour #291334
--ui-signature / --ui-signature-hover / --ui-signature-strong Green accents, hover states and stronger green text #00ca72 / #00b465 / #00844b
--ui-signature-soft / --ui-signature-content Tinted background and text on signature green #d9f7e8 / #291334
--ui-accent-soft Soft yellow background #fde9b0
--ui-tint-lavender / --ui-tint-periwinkle / --ui-tint-mint / --ui-tint-sky Section and tile backgrounds #eeecfd / #d5d9fc / #e6f5f4 / #d3e8fd
--ui-highlight Highlight background #b3f0d2
--ui-icon-violet / --ui-icon-periwinkle / --ui-icon-pink / --ui-icon-coral / --ui-icon-teal Illustration and icon colours #ac6df7 / #9e9cf8 / #e7b4d1 / #eb8b70 / #61baae

These added properties have dark-theme values too. Reference them in custom CSS with var(...); they are not additional named Tailwind colour utilities.

The core tokens are exposed as Tailwind colour utilities: bg-panel, bg-panel-muted, bg-surface, text-ink, text-ink-muted, text-ink-faint, border-line, bg-brand, text-brand, bg-brand-soft, text-brand-content, bg-accent, text-danger, bg-danger-soft, text-ok, bg-ok-soft, text-warn, bg-warn-soft, text-info, bg-info-soft, plus rounded-card, rounded-field, shadow-card and shadow-pop.

Pages authored before version 11 used the semantic colour names of the previous component library. Those names still resolve to the new tokens: primary is the brand colour, secondary the accent, base-100 / base-200 / base-300 are panel, muted panel and line, base-content is ink, and error, success, warning, info map to the status colours.

Component vocabulary

Family Classes
Buttons btn, btn-primary, btn-secondary, btn-accent, btn-ghost, btn-outline, btn-link, btn-danger, btn-success, btn-warn; sizes btn-xs, btn-sm, btn-lg; btn-icon, btn-block
Badges badge, badge-brand, badge-accent, badge-ok, badge-warn, badge-danger, badge-info, badge-neutral, badge-outline, badge-dot; sizes badge-xs, badge-sm, badge-lg
Surfaces card, card-body, card-title, card-actions, card-interactive, card-accent, brand-band, divider, stats, stat, stat-title, stat-value, stat-desc
Feedback alert (+ alert-danger, alert-warn, alert-ok, alert-info), spinner, skeleton, progress (+ progress-ok, progress-warn, progress-danger), radial-progress, tooltip
Fields field, field-label, field-hint, field-error, input, select, textarea, checkbox, radio, toggle, range, file-input; sizes -xs, -sm, -lg; error state input-error
Overlays and navigation modal, modal-box, modal-action, dropdown, dropdown-content, menu, menu-item, tabs, tab, tab-active, tabs-pill, breadcrumbs
Data and chat table, table-hover, table-xs, table-sm, avatar, chat, chat-start, chat-end, chat-bubble, chat-header, chat-footer
Layout helpers kept for existing pages hero, hero-content, navbar, navbar-start, navbar-center, navbar-end, collapse, collapse-title, collapse-content, steps, step, join, join-item, indicator, indicator-item, link

Legacy names such as btn-error, badge-primary, alert-warning, loading loading-spinner, form-control, label and label-text are aliases of the classes above. Components that only existed in the previous library (mockup-window, timeline, drawer, swap, diff, stack, mask, rating, countdown, kbd) are no longer styled; rebuild those sections with utilities.

Branding a portal with tokens

Because the tokens inherit, a page can be re-branded without touching individual elements. Add a style block to the page (Custom code block or the page settings) and override the variables on the body or on a wrapper:

<style>
    body {
        --ui-brand: #0b5fff;
        --ui-brand-hover: #084ad0;
        --ui-brand-soft: #e6eeff;
        --ui-brand-content: #ffffff;
        --ui-accent: #ffb020;
        --ui-surface: #f7f8fb;
    }
</style>

Guidance:

Fonts

The builder's Install Fonts button integrates Google Fonts (needs Google_Fonts_API_Key__c). Chosen fonts are emitted as font links into the compiled page HTML at save, so they load on the live portal. The design system uses Inter when it is installed and falls back to the system font stack otherwise.

Component styling inside shadow DOM

Most standard components render in the light DOM and pick up the page level stylesheet directly. The chart, login, iframe, repeater, conditional content and dashboard components render in shadow DOM; each imports a compiled copy of the design system, and a build step rewrites :root variables to :host so the tokens apply inside the shadow boundary. Because the tokens are custom properties, a token override on the page still reaches those components.

Brand system in the AI builder

The AI builder keeps a persisted brand design system (palette, heading and body fonts, corner radius, vibe, tone, and a creativity dial). It emits --ui-* token overrides plus raw brand tokens, applied identically in the canvas, the AI preview, and the live portal. Generated pages use the component vocabulary and semantic colour utilities so the brand cascades everywhere. See The AI page builder.

Creating a custom branded portal

Branding a portal is a combination of the page design and the portal record settings:

  1. Design the pages with the component vocabulary, semantic colour utilities and your fonts. Override the --ui-* tokens on the body for the brand palette.
  2. Create a branding static resource containing your logos and icons (at least 192px and 512px). Set its name in the Web Portal Branding_Resource_Name__c (default b3p__Branding). This drives the PWA icons, favicons, and splash screen.
  3. Set the PWA fields on the Web Portal record: short name, description, theme colour, background colour, start URL, status bar type, viewport. These control the installed app identity and colours. See Configuration reference and Progressive Web Apps.
  4. Use dynamic sub templates for shared branded chrome (header, footer, navigation) so branding stays consistent and updates in one place. See Web portals and pages.

The result is a portal that looks like the customer's brand in the browser and, when installed to a phone, uses the customer's name, icon, splash, and theme colour as a standalone app.

Practical tips