You will learn

How to use custom CSS to change the appearance of Klaviyo web chat — the launcher, the chat window, message bubbles, and the message composer. You'll learn which theme variables and class names are safe to target, and which ones will break when Klaviyo ships an update.

This article applies whether you use web chat on its own or as part of Customer Hub. The chat interface is the same in both cases, so the same CSS works for both.

Before you begin

Custom CSS is only recommended for technically savvy marketers, or those with access to a developer. Klaviyo's support team can offer general guidance but cannot write or debug custom CSS for you.

You'll need:

  • An Owner, Admin, or Manager role
  • Familiarity with CSS selectors and custom properties (CSS variables)

Before writing custom CSS, check whether the built-in design settings already do what you need. Colors, fonts, button shape, and launcher position are all configurable without code, and those settings survive Klaviyo updates. Reach for custom CSS only for what the design settings don't cover.

Where to add your custom CSS

Where you find the Custom CSS editor depends on your setup.

If you use Customer Hub

  1. Navigate to Customer Hub > Design.
  2. Scroll to the Custom section at the bottom of the style settings.
  3. Click Add custom CSS, or edit the CSS already there.
  4. Click Save.

If you use standalone web chat

  1. Navigate to Settings > Web chat > Design.
  2. Scroll to the Custom section at the bottom of the style settings.
  3. Click Add custom CSS, or edit the CSS already there.
  4. Click Save.

If you have Customer Hub enabled, the web chat design settings will point you to Customer Hub instead. This is expected — Customer Hub owns the design for both surfaces, so there's one place to style everything.

How custom CSS is applied

Your CSS is added to a style tag on your storefront, after Klaviyo's own styles. Two things follow from this:

  • Your CSS wins. Because it loads last, your rules override Klaviyo's defaults without needing !important in most cases.
  • Your CSS is not scoped to the chat. It applies to your whole page. Always scope your selectors to a chat element rather than writing bare rules like button { … }, which would affect your entire storefront.

Start with theme variables

The most reliable way to restyle web chat is to override Klaviyo's theme variables in a :root block. These are stable, they cascade correctly through the whole interface, and they're much less likely to break than targeting individual elements.

css
:root {
  --atlas-chat-bubble-background: #f0ebe4;
  --atlas-message-border-radius: 4px;
}

Chat message variables

Variable

Default

Controls

--atlas-chat-bubble-background

#f2f2f2

Background of agent (incoming) messages

--atlas-chat-bubble-text-primary

#322e2f

Text color of agent (incoming) messages

--atlas-chat-bubble-display-name

#797979

Sender name shown above a message

--atlas-message-border-radius

16px

Corner radius on all message bubbles

Shopper (outgoing) messages intentionally reuse your brand colors: the bubble takes --atlas-button-primary and the text takes --atlas-text-primary-inverse, both of which you set in the design settings.

Color and surface variables

Variable

Default

Controls

--atlas-background-main

#faf9f8

Chat window background

--atlas-background-content

#ffffff

Cards and raised surfaces

--atlas-text-primary

#1d1e20

Body text

--atlas-text-secondary

#4b4d4e

Secondary and helper text

--atlas-text-placeholder

#747576

Composer placeholder text

--atlas-primary-color

#3f5260

Accent color

--atlas-button-primary

#3f5260

Primary button and shopper bubble background

--atlas-text-primary-inverse

#ffffff

Text on primary buttons and shopper bubbles

--atlas-border-light

rgba(0, 0, 0, 0.05)

Subtle dividers

--atlas-border-focus

#41a1e6

Focus ring color

Shape and spacing variables

Variable

Default

Controls

--atlas-drawer-inset-border-radius

12px

Chat window corner radius

--atlas-button-border-radius

8px

Button corner radius

--atlas-input-border-radius-normal

8px

Input corner radius

--atlas-card-border-radius-normal

24px

Card corner radius

--atlas-shadow-medium

0px 8px 16px 0px rgba(55, 63, 71, 0.2)

Chat window shadow

Typography variables

Variable

Default

Controls

--atlas-font-family

System font stack

Body font

--atlas-heading-font-family

System font stack

Heading font

--atlas-font-size-normal

16px

Base body size

--atlas-font-size-small

14px

Small text size

--atlas-font-weight-normal

400

Body weight

--atlas-font-weight-heading

700

Heading weight

Several of these are already written from your design settings. Setting fonts and colors in the design settings UI is preferable — use the variables for values the UI doesn't expose.

Target elements with class hooks

When a theme variable won't do, target elements directly. Klaviyo guarantees the class names below.

Any class name you find in your browser's inspector that is not on this list is not safe to use. Most internal class names include a build hash (for example Chat-chatWindow-a1B2c) that changes every time Klaviyo ships an update, silently breaking your CSS. The rule of thumb: if a class starts with kl-hub-, it's safe. If it doesn't, it isn't.

Chat elements

Selector

Element

.kl-hub-launcher

The floating chat launcher button

.kl-hub-drawer

The chat window

.kl-hub-drawer__header

The chat window header

.kl-hub-drawer__content

The scrollable message area

.kl-hub-message

A message bubble (agent and shopper alike)

.kl-hub-chat-input-wrapper

The message composer container

.kl-hub-chat-input

The composer text field

.kl-hub-chat-prompt-button

Conversation starter and quick reply buttons

.kl-hub-modal-veil

The backdrop behind the chat window

The chat window also carries a class naming the current screen — .kl-hub-route-chat for the chat itself. In standalone web chat this is always .kl-hub-route-chat. In Customer Hub it changes as the shopper navigates (.kl-hub-route-home, .kl-hub-route-orders, and so on), which lets you scope CSS to one screen.

The send button has no dedicated class. Target it through the composer:

css
.kl-hub-chat-input-wrapper .kl-hub-button-primary {
  background: #2f4f4f;
}

Shared elements

Selector

Element

.kl-hub-text

Any text element

.kl-hub-heading

Any heading (also .kl-hub-h1 through .kl-hub-h5)

.kl-hub-p

Paragraph text (also .kl-hub-p-small, .kl-hub-p-tiny, .kl-hub-p-large)

.kl-hub-link

Links

.kl-hub-button

Any button (also .kl-hub-button-primary, .kl-hub-button-secondary, .kl-hub-button-tertiary)

.kl-hub-input

Any text input

.kl-hub-card

Cards, including product cards

.kl-hub-thumbnail

Product thumbnails

.kl-hub-icon

Icons

.kl-hub-toast

Toast notifications

Styling agent and shopper messages differently

This is the most common request, and it needs a specific approach. Agent and shopper bubbles share the single .kl-hub-message class — there is no stable class distinguishing them, so you cannot select one directly.

Instead, use the theme variables, which already treat the two differently:

css
:root {
  /* Agent messages */
  --atlas-chat-bubble-background: #f0ebe4;
  --atlas-chat-bubble-text-primary: #2b2b2b;

  /* Shopper messages */
  --atlas-button-primary: #1f3a3d;
  --atlas-text-primary-inverse: #ffffff;
}

--atlas-button-primary also colors your primary buttons. If you need the shopper bubble and your buttons to differ, that isn't currently supported.

Examples

Square everything off

css
:root {
  --atlas-drawer-inset-border-radius: 0;
  --atlas-message-border-radius: 0;
  --atlas-button-border-radius: 0;
  --atlas-input-border-radius-normal: 0;
}

Uppercase headings and buttons

css
.kl-hub-heading,
.kl-hub-button {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

Make the launcher larger with a custom shadow

css
.kl-hub-launcher {
  width: 72px !important;
  height: 72px !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25) !important;
}

The launcher sets several properties directly on the element, so launcher rules need !important to take effect. This is the one place it's routinely required.

Widen the chat window on desktop

css
@media (min-width: 900px) {
  .kl-hub-drawer {
    width: 480px;
  }
}

If your CSS won't save

When you save, Klaviyo checks that your CSS parses. If it doesn't, you'll see Invalid CSS. Please check your syntax. and your changes won't be saved.

A stylesheet is only rejected outright when it produces no rules at all, which usually means what you pasted isn't CSS. Common causes:

  • Pasting plain text, HTML, or a style tag rather than CSS rules
  • Pasting part of a declaration rather than a complete rule
  • A stylesheet in which every rule has a syntax error

A single syntax error usually will not block the save. It quietly breaks the rules around it instead. Stray text before a rule is absorbed into that rule's selector, so the rule matches nothing. An unclosed rule swallows the declarations that follow it. A stray closing brace is ignored. So if a rule you wrote has no effect, check the syntax of everything above it, not just the rule itself.

What custom CSS can't do

  • Change text. Custom CSS cannot edit wording. Use the design and content settings for that.
  • Reorder or reposition elements beyond what CSS layout allows. The structure of the chat is not customizable.
  • Target agent and shopper bubbles separately by class. Use theme variables, as described above.
  • Survive redesigns automatically. Class hooks and variables are stable across normal updates, but a significant redesign may require revisiting your CSS. Re-test after major releases.

Additional resources

  • How to style your Customer Hub

    Learn about design options for styling your Customer Hub drawer, and how you can design it to match your brand. Because the Customer Hub interface is ingrained in the customer experience, it’s best practice to style it to appear as an extension of your website.

  • Getting started with web chat

    Learn about web chat, which is a 2-way communication channel you can add to your website. Web chat can be set up on its own for you to use with Customer Agent and Helpdesk, but it's also designed to be a seamless part of Customer Hub. Web chat allows your business to engage in live, personalized conversations with visitors on your website so they can easily get answers to their questions or assistance with issues.

  • Troubleshooting custom CSS, JavaScript, and HTML in Klaviyo

    Learn how to troubleshoot custom code when importing a custom HTML template or building your own custom coded template.

Was this article helpful?
Use this form only for article feedback. Learn how to contact support.

Explore more from Klaviyo

Community
Connect with peers, partners, and Klaviyo experts to find inspiration, share insights, and get answers to all of your questions.
Partners
Hire a Klaviyo-certified expert to help you with a specific task, or for ongoing marketing management.
Support

Access support through your account.

Email support (free trial and paid accounts) Available 24/7

Chat/virtual assistance
Availability varies by location and plan type