Menu

Overriding Flex UI themes, branding and styling

Auto-Generated Documentation for the Flex UI is now available as a beta distribution. The auto-generated documentation is accurate and comprehensive, and so may differ from what you see in the official Flex UI documentation.

The Flex UI exposes 3 main levels of customization:

  1. Base Themes: Predefined themes Flex comes with out of the box.
  2. Base Theme Color Overrides: Global color overrides that are inherited by all Flex UI Components.
  3. Component Theme Overrides: Granular color overrides that allow you to customize a specific component.

So, you might use the GreyLight Flex theme with an override of one of its colors, and a specific color override in the Notifications component.

Defining your theme

Base themes

Base themes provide a set of colors as a starting point for your contact center. The Flex UI includes the following predefined base themes:

  • GreyLight
  • GreyDark
  • FlexLight
  • FlexDark

Configuring a base theme

You can configure the desired base theme in the Flex configuration object.

const configuration = {
        colorTheme: {
            baseName: "FlexDark"
        }
};

Overriding base theme colors

You can also create your own variation of a theme by re-configuring base colors used in the theme.

In the below example, Flex uses GreyDark as its base theme. It will then apply the new colors defined in the color object, overriding the base colors and some standard colors of the GreyDark theme.

const configuration = {
    colorTheme: {
        baseName: "GreyDark",
        colors: {
            base0: "#000000",
            base1: "#222222",
            base2: "#444444",
            base3: "#d4d4d4",
            base4: "#e0e0e0",
            base5: "#efefef",
            base6: "#ffffff",
            darkTextColor: "#222222",
            buttonHoverColor: "rgba(0, 0, 0, 0.2)",
            tabSelectedColor: "#009cff",
            connectingColor: "#ff9800",
            disconnectedColor: "#c0192d"
        }
    }
};

See the complete list of overridable base theme colors.

Overriding individual components

Flex Theming also supports granular customizations at the individual component level. In the following code sample, Flex will override the MainHeader background color and text color, as well as the SideNav background color and button colors.

const configuration = {
    colorTheme: {
        overrides: {
            MainHeader: {
                Container: {
                    background: "#2f5771",
                    color: "#ffffff"
                }
            },
            SideNav: {
                Container: {
                    background: "#4a4e60"
                },
                Button: {
                    background: "#4a4e60"
                },
            }
        }
    }
};

See the complete list of customizable components and properties.

Applying your theme

Once you've defined a theme, you'll need to apply it to Flex UI.

Applying your theme in a Flex Plugin

Define your color theme by specifying a baseName, along with optional colors and component overrides.

CustomTheme.js

export default {
    baseName: "GreyDark",
    colors: {
        base0: "#000000",
        base1: "#222222",
        base2: "#444444"
    },
    overrides: {
        MainHeader: {
            Container: {
                background: "#2f5771",
                color: "#ffffff"
            }
        },
        SideNav: {
            Container: {
                background: "#4a4e60"
            },
            Button: {
                background: "#4a4e60"
            },
        }
    }
}

Then set your custom theme inside the Flex Configuration colorTheme property and apply it during plugin initialization.

ThemePlugin.js

import { FlexPlugin } from 'flex-plugin';
import React from 'react';
import CustomTheme from './CustomTheme'

const PLUGIN_NAME = 'ThemePlugin';

export default class ThemePlugin extends FlexPlugin {
  constructor() {
    super(PLUGIN_NAME);
  }

  init(flex, manager) {
    const configuration = {
        colorTheme: CustomTheme
    };

    // apply theme
    manager.updateConfig(configuration);
  }
}

Applying themes to self-hosted installations of Flex

Include your custom theme in the configuration object's colorTheme property when initializing Flex.

const configuration = {
    colorTheme: {
        baseTheme: 'FlexDark'
    }
}

Twilio.Flex.runDefault(configuration);

Next Steps

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more