Skip to main content

Styling your Referral Campaign

Written by Kris - Mage Loyalty
Updated over 2 weeks ago

Customize the look and feel of your referral campaign block using the built-in CSS editor. You can find it in the Advanced tab when editing a referral campaign, under Custom CSS.

The editor provides autocomplete for all available CSS classes and ready-made snippets to get you started quickly.

How It Works

All referral campaign elements use CSS classes prefixed with .mage-referral-campaign. The popup overlay uses .mage-referral-popup.

Type any of these prefixes in the editor and autocomplete will suggest matching classes.

CSS Snippets Reference

The editor includes built-in snippets that insert pre-configured blocks of CSS with sensible defaults. Start typing a snippet name and select it from the dropdown to insert it.

Each snippet includes placeholder values you can tab through and edit.

Snippet

Description

card

Card background color, border-radius, and padding

typography

Title and subtitle font size, weight, and color

button

Primary action button colors and border-radius

input

Text input background, border, and text color

social-buttons

Social share button colors for each platform (Twitter, Facebook, WhatsApp, Email, SMS) and shared shape

url-box

Referral URL container and copy button styling

code-box

Discount code display container and text size

footer

Footer text size, color, and opacity

two-column

Form panel padding and media panel background settings for the two-column layout

popup

Popup overlay backdrop color, content max-width, and close button styling

email-dialog

Email share dialog input fields and send button

stack-layout

Stack layout variant overrides for social and copy buttons (pill shape, larger padding)

CSS Class Reference

Campaign Block

Class

Description

.mage-referral-campaign

Root container (flex, min-height 500px, centered)

.mage-referral-campaign--align-start

Left-aligned content

.mage-referral-campaign--align-end

Right-aligned content

.mage-referral-campaign--has-bg

Has a background image set

.mage-referral-campaign--two-column

Two-column layout variant

.mage-referral-campaign__loading

Loading skeleton (animate-pulse)

.mage-referral-campaign__card

Content card (rounded-2xl, padded)

.mage-referral-campaign__title

Heading (bold, tight tracking)

.mage-referral-campaign__subtitle

Subtitle (leading-relaxed)

.mage-referral-campaign__error

Error message (red-400, red-tinted bg)

.mage-referral-campaign__form

Sign-up form container

.mage-referral-campaign__input

Text input (rounded-lg, border, outline-none)

.mage-referral-campaign__checkbox

Checkbox row (flex, items-center, gap)

.mage-referral-campaign__terms-link

Terms & conditions link (underlined)

.mage-referral-campaign__button

Primary action button (full-width, semibold, border-2)

.mage-referral-campaign__url-box

Referral URL container (flex, rounded-lg, border, semi-transparent bg)

.mage-referral-campaign__url

URL text input (mono, transparent bg, no border)

.mage-referral-campaign__copy-btn

Copy to clipboard button (rounded, semibold)

.mage-referral-campaign__social

Social share buttons row (flex, gap)

.mage-referral-campaign__social-btn

Base social share button (flex-1, rounded-lg, white text)

.mage-referral-campaign__social-btn--twitter

Twitter/X button (black bg)

.mage-referral-campaign__social-btn--facebook

Facebook button (blue bg)

.mage-referral-campaign__social-btn--email

Email button (zinc-600 bg)

.mage-referral-campaign__social-btn--whatsapp

WhatsApp button (green bg)

.mage-referral-campaign__social-btn--sms

SMS button (green bg)

.mage-referral-campaign__code-box

Discount code container (flex, rounded-lg, border, semi-transparent bg)

.mage-referral-campaign__code

Discount code text (mono, lg, semibold, tracked)

.mage-referral-campaign__footer

Footer text (mt-6, opacity-60)

.mage-referral-campaign__mobile-media

Mobile background image panel (hidden by default, shown on mobile with bg image)

Stack Layout Modifiers

Applied when the campaign uses the stack share layout.

Class

Description

.mage-referral-campaign__url-box--stack

Stack variant URL box

.mage-referral-campaign__social--stack

Stack variant social row (flex-col, gap-3)

.mage-referral-campaign__social-btn--stack

Stack variant social button (rounded-full, py-4, bold, tracked)

.mage-referral-campaign__copy-btn--stack

Stack variant copy button (full-width, rounded-full, py-4, bold, tracked)

Two-Column Layout

Class

Description

.mage-referral-campaign__columns

Two-column flex wrapper (min-height 500px, full-width)

.mage-referral-campaign__column-form

Form column (w-1/2, centered, padded)

.mage-referral-campaign__column-media

Media/image column (w-1/2, background-cover)

On mobile (below 768px), the columns stack vertically β€” media on top, form below.

Email Share Dialog

Class

Description

.mage-referral-campaign__email-dialog

Dialog form container (flex-col, gap-4)

.mage-referral-campaign__email-dialog-field

Form field wrapper (flex-col, gap)

.mage-referral-campaign__email-dialog-label

Field label (14px, semibold, gray-900)

.mage-referral-campaign__email-dialog-input

Text input (rounded-lg, gray-200 border, white bg)

.mage-referral-campaign__email-dialog-textarea

Message textarea (rounded-lg, gray-200 border, white bg, no-resize)

.mage-referral-campaign__email-dialog-send

Send button (full-width, rounded-lg, gray-900 bg, white text)

.mage-referral-campaign__email-dialog-error

Error banner (red-50 bg, red-600 text)

.mage-referral-campaign__email-dialog-success

Success banner (green-50 bg, green-600 text)

Popup

Class

Description

.mage-referral-popup__overlay

Fixed fullscreen backdrop (black/60, flex, centered, z-9999)

.mage-referral-popup__content

Popup content wrapper (max-w-4xl, max-h-90vh, overflow-y-auto)

.mage-referral-popup__close

Close button (absolute top-right, rounded-full, black/40 bg, white text)

Tips

  • Start with a snippet, then refine. Insert the card or button snippet, adjust the placeholder values to match your brand, and preview the result.

  • Use the class inspector in preview mode. When previewing your campaign in the editor, click the gear icon in the top-right corner to enable the class inspector. Hover over any element to see its CSS classes. Press C to copy them to your clipboard.

  • The popup inherits campaign styles. Any custom CSS you write for the campaign block also applies when the campaign is displayed as a popup. Use the popup snippet to customize the overlay and close button independently.

  • Stack layout is a separate set of classes. If your campaign uses the stack share layout, the social buttons and copy button get additional --stack modifier classes. Use the stack-layout snippet to customize these independently from the default inline layout.

  • Mobile responsive. The two-column layout automatically stacks on mobile (below 768px). The media column moves above the form column on small screens.

Did this answer your question?