Auto-Generated Documentation for the Flex UI is now available. The auto-generated documentation is accurate and comprehensive, and so may differ from what you see in the official Flex UI documentation. It includes a comprehensive overview of Theme options.
The Flex UI exposes 3 main levels of customization:
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.
Base themes provide a set of colors as a starting point for your contact center. The Flex UI includes the following predefined base themes:
You can configure the desired base theme in the Flex configuration object.
1const configuration = {2colorTheme: {3baseName: "FlexDark"4}5};
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.
1const configuration = {2colorTheme: {3baseName: "GreyDark",4colors: {5base0: "#000000",6base1: "#222222",7base2: "#444444",8base3: "#d4d4d4",9base4: "#e0e0e0",10base5: "#efefef",11base6: "#ffffff",12darkTextColor: "#222222",13buttonHoverColor: "rgba(0, 0, 0, 0.2)",14tabSelectedColor: "#009cff",15connectingColor: "#ff9800",16disconnectedColor: "#c0192d"17}18}19};
See the complete list of overridable base theme colors.
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.
1const configuration = {2colorTheme: {3overrides: {4MainHeader: {5Container: {6background: "#2f5771",7color: "#ffffff"8}9},10SideNav: {11Container: {12background: "#4a4e60"13},14Button: {15background: "#4a4e60"16},17}18}19}20};21
See the complete list of customizable components and properties.
Once you've defined a theme, you'll need to apply it to Flex UI.
Define your color theme by specifying a baseName
, along with optional colors
and component overrides
.
CustomTheme.js
1export default {2baseName: "GreyDark",3colors: {4base0: "#000000",5base1: "#222222",6base2: "#444444"7},8overrides: {9MainHeader: {10Container: {11background: "#2f5771",12color: "#ffffff"13}14},15SideNav: {16Container: {17background: "#4a4e60"18},19Button: {20background: "#4a4e60"21},22}23}24}
Then set your custom theme inside the Flex Configuration colorTheme
property and apply it during plugin initialization.
ThemePlugin.js
1import { FlexPlugin } from 'flex-plugin';2import React from 'react';3import CustomTheme from './CustomTheme'45const PLUGIN_NAME = 'ThemePlugin';67export default class ThemePlugin extends FlexPlugin {8constructor() {9super(PLUGIN_NAME);10}1112init(flex, manager) {13const configuration = {14colorTheme: CustomTheme15};1617// apply theme18manager.updateConfig(configuration);19}20}21
Include your custom theme in the configuration object's colorTheme
property when initializing Flex.
1const configuration = {2colorTheme: {3baseTheme: 'FlexDark'4}5}67Twilio.Flex.runDefault(configuration);