ShopifyStorefront blocks

Styling the blocks

How the blocks take your theme's look, the shared style settings, and the tokens a theme developer can set.

In build

The blocks are meant to look like part of your store, not like something embedded in it. They start from your theme and you adjust from there.

Three layers

Each layer overrides the one before it.

LayerWhereApplies to
Your themeNothing to setEvery block follows your theme's text color and font by default
The app embed's Style groupApp embeds, then FanBaseEvery block
A block's own settingsThat blockThat block only

Start by setting nothing. On most themes the blocks already fit. Then set an accent color in the app embed, and reach for a single block's settings only when one block sits on a different background from the rest.

The Style group

SettingDefaultWhat it changes
Accent colorYour themeButtons, links, progress bars, selected states
Corner radius8 pxCorners of cards, buttons and pop-ups, 0 to 24 px
Spacing12 pxThe gaps between and inside cards, 0 to 32 px
Text colorYour themeAll text
Secondary text colorYour themeDescriptions, labels and hints
Border colorYour themeCard outlines and dividers
Surface colorThe page behind the blockThe background of pop-ups and dialogs
Error colorMessages when something fails
Success color"Completed" and "Claimed"
Focus ring colorThe outline around a control reached by keyboard

A color left empty follows your theme.

Surface color rarely needs setting. A pop-up takes the background it finds behind the block, so a dark theme gets a dark pop-up on its own.

What each block adds

Every block has its own Accent color and Corner radius, which win over the app embed for that block. A few have more:

BlockIts own settings
QuestsText color, glass color, card width, card height, pop-up inset
Account indicatorText color, accent color, size

The quests block has the most because its cards sit on pictures. Glass color is the frosted panel over each picture, and Text color is what is written on it. Pick the two together so the text reads on the glass.

The account indicator has its own because a header is often a different color from the page. Set its text color to match your header icons.

For theme developers

Everything in the Style group is a CSS custom property. Set them in your theme's stylesheet on any element that contains the blocks, and they apply exactly as if they had been set in the editor.

.your-rewards-page {
  --fanbase-accent: #7c3aed;
  --fanbase-radius: 12px;
  --fanbase-gap: 16px;
}
PropertyUsed for
--fanbase-accentButtons, links, progress, selected states
--fanbase-radiusCorners
--fanbase-gapSpacing
--fanbase-textText
--fanbase-mutedSecondary text
--fanbase-borderOutlines and dividers
--fanbase-surfacePop-up and dialog backgrounds
--fanbase-dangerFailure messages
--fanbase-success"Completed" and "Claimed"
--fanbase-focusKeyboard focus rings
--fanbase-fontThe font family. Inherits from your theme by default.

This is how to give one page a different look from another, or to follow a dark section of an otherwise light theme: scope the properties to that section.

A block's own editor settings still win over these, so leave a block's color settings empty if you are styling from CSS.

What is fixed

The layout of each block is part of the block. You choose colors, corners, spacing and the sizes each block exposes. You do not rearrange what is inside a card.

If your design needs a layout the blocks do not offer, that is what the React SDK is for: the same features with no markup of their own. Tell your FanBase contact what you are trying to build. Requests like that shape which options the blocks get next.

Accessibility

The blocks keep their own keyboard and screen reader behaviour whatever you set: focus rings on every control, labels for screen readers, and motion that respects a device's reduced motion setting.

Two things are yours to check after choosing colors. Text has to stay readable against whatever is behind it, most of all on the quest cards' glass. And the focus ring has to be visible on your background. Set Focus ring color if it is not.

On this page