Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page

Flex UI Components


(information)

Info

Auto-Generated Documentation for the Flex UI(link takes you to an external page) 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.

Flex UI is a library of programmable or dynamic components that expose a Content property and allows you to add, replace and remove any component and its children.


Content property and add / replace / remove methods

content-property-and-add--replace--remove-methods page anchor

Below you can find a list of UI components and their details, that can be overridden programmatically. This can be done by using add, replace and remove methods with options.

(warning)

Warning

All components must have a key declared.

Syntax for add/replace methods

syntax-for-addreplace-methods page anchor
1
Flex.Component.Content.add(<MyComponent key="demo-component"/>, {options});
2
Flex.Component.Content.replace(<MyComponent key="demo-component"/>, {options});

Example

Below is an example of adding a component called AnotherMuteButton to the MainHeader component, aligned to the end (here left) and placed as the first component in front of native components MuteButton and UserControls:

1
Flex.MainHeader.Content.add(<AnotherMuteButton key="mute"/>, {
2
sortOrder: -1,
3
align: "end"
4
});

Syntax for remove method

syntax-for-remove-method page anchor

Remove method allows you to remove immediate children of a programmable component by their key.

Flex.Component.Content.remove(key, {options});

Example

Below is an example of removing the AnotherMuteButton component from the MainHeader component. This component is removed by the key we set above, "mute".

Flex.MainHeader.Content.remove("mute");

Options for add/replace/remove methods

options-for-addreplaceremove-methods page anchor

if (Expression)

if-expression page anchor

Used in both add and replace methods to add conditions on which component is added or replaced.

Example

1
Flex.MainHeader.Content.add(<AnotherMuteButton key="mute"/>, {
2
if : props => props.task.source.taskChannelUniqueName === "custom1"
3
});

Used in add method to specify the order in which the new component is placed in relation to other children of the parent component. Native children components take priority. Sort order counter starts with 0. To always place a new component at the very start or end of the order, use large numbers like -100 or 100, depending on the direction.

Example

1
Flex.MainHeader.Content.add(<AnotherMuteButton key="mute"/>, {
2
sortOrder: -1
3
});

align ('start' | 'end')

align-start--end page anchor

Used in the add method to align new components either to the top/bottom or right/left, depending on the direction of the parent component. Possible values are:

  • start - Aligns new component on the left or top
  • end - aligns new component on the right or bottom

Example

1
Flex.MainHeader.Content.add(<AnotherMuteButton key="mute"/>, {
2
align: "end"
3
});

Each immediate child of a component has a key (required for the add and replace methods) and a set of properties that will be inherited by its children. To find a component's key or explore component props, go to Flex UI API Reference(link takes you to an external page).

Agents Desktop View components overview

agents-desktop-view-components-overview page anchor
Twilio Flex interface showing chat with Damien Smith and account details.

Teams View components overview

teams-view-components-overview page anchor
Supervisor UI showing agent list, live calls, and profile details with skills and tasks.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Header with menu icon, microphone, and user status showing Jane Martin online.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Chat interface showing conversation between Damien Smith and Robert Ryan about an order.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

LiveCommsBar showing call status with options to return or stop listening.

Direction: Horizontal

Customizing the NotificationsBar is described in Notifications Framework

Network issue notification with orange icon and close button.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Expanded sidenav with options: Dashboard, Task View, Admin, Supervisor, Directory, and Settings.

Agent Desktop View Components

agent-desktop-view-components page anchor

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Agent desktop view with account details, activity map of San Francisco, and status notifications.

AgentDesktopView.Panel1

agentdesktopviewpanel1 page anchor

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

AgentDesktopViewPanel1-v2.

AgentDesktopView.Panel2

agentdesktopviewpanel2 page anchor

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Flex.AgentDesktopView.Panel2.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Message stating no CRM configured with a button labeled 'How to Configure'.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Status screen showing no active tasks with user James Smith set to unavailable.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Task list showing names, task status, and icons for chat, phone, and Facebook.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

For details on how to configure filters for the task list, see the UI configuration page.

Task list showing communication channels and task statuses for contacts.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Add / Replace / Remove and properties of the TaskListItem are described in the Task Channel Definition API.

Task item showing a phone icon, name, time elapsed, and task status.

Direction: Horizontal

Add / Replace / Remove and properties of the TaskListItem are described in the Task Channel Definition API.

Green checkmark and red cross buttons for task management.

Examples

Adding a button to Chat type task

1
Flex.DefaultTaskChannels.Chat.addedComponents = [{
2
target: "TaskListButtons",
3
component: <Flex.IconButton key="eye_button" icon="Eye" />
4
}];

Adding a button to Chat type task when it is in accepted state

1
Flex.DefaultTaskChannels.Chat.addedComponents = [{
2
target: "TaskListButtons",
3
component: <Flex.IconButton key="eye_button" icon="Eye" />,
4
options: { if: props.task.status === "accepted" }
5
}];
6

Removing a reject button from Chat type task

1
Flex.DefaultTaskChannels.Chat.removedComponents = [{
2
target: "TaskListButtons",
3
key: "reject"
4
}];

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Taskcanvas-v2.width-500.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Task header showing Damien Smith live with a timer at 34 seconds.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Navigation icons for info, chat, call, and video with chat selected.

Example

Add tabs and content

1
import { Tab } from "@twilio/flex-ui"
2
3
init(flex, manager) {
4
const Img = <img src="http://someimage.jpg" />;
5
6
flex.TaskCanvasTabs.Content.add(
7
<Tab icon={Img} iconActive={Img} key="my-new-tab">
8
<MyNewTabComponent/>
9
</Tab>
10
);
11
}

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Customer info panel showing contact details and previous interactions for Jean Spencer.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Chat request from Customer 29182 with accept and decline options.

IncomingTaskCanvasActions

incomingtaskcanvasactions page anchor

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Incoming call from queue 'Everyone' with accept and reject options.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Call interface showing a live call with one participant on hold and another listening.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

CallCanvasActions.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

MessagingCanvas-v2.width-500.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Chat messages between Damien Smith and Robert Ryan with timestamps.

MessageList.WelcomeMessage

messagelistwelcomemessage page anchor

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Chat started with Damien Smith.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Chat message from Damien Smith at 18:42 saying 'Incididunt ut labore et dolore magna aliqua.'.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Message bubble from Damien Smith at 18:42 saying 'Incididunt ut labore et dolore magna aliqua.'.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Text input field with send button in Twilio Flex interface.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Transfer interface with tabs for Agents and Queues, showing agent statuses and queue names.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

WorkerDirectoryTabs.

The Worker directory contains 2 tabs by default:

  • Agents - key workers
  • Queues- key queues

Example: Add new custom tab

1
Flex.WorkerDirectory.Tabs.Content.add(
2
<Flex.Tab key="my-tab" label="My Tab">
3
<div> "Hello World"
4
</div>
5
</Flex.Tab>
6
);

Worker Directory Tabs Hidden Filters

WorkerDirectoryTabs accepts 2 default props:

  • hiddenWorkerFilter
  • hiddenQueueFilter

These filters are applied to the list in combination with the filter applied by the user typing in the search string. You can programmatically apply a filter that is hidden from the user, i.e. the user cannot disable it. You could use this feature to pre-filter the list of available transferees an agent can search and choose from, to their team members or available agents only. In the following example, we use live query to:

  • filter the agents list to only show agents with a specific team_name attribute (you can set user attributes via your SSO provider)
  • filter the agents list to only show agents that are in the Available activity
  • filter the queues list to only show queues with a specific queue_name attribute
1
// Filter Agents by Worker Attributes or activity_name
2
Flex.WorkerDirectoryTabs.defaultProps.hiddenWorkerFilter = 'data.attributes.team_name CONTAINS "sales"'
3
Flex.WorkerDirectoryTabs.defaultProps.hiddenWorkerFilter = 'data.activity_name CONTAINS "Available"'
4
5
// Filter Queues by queue_name or queue_sid
6
Flex.WorkerDirectoryTabs.defaultProps.hiddenQueueFilter = 'data.queue_name CONTAINS "sales"'

The hidden filter feature is only available in @twilio/flex-ui@1.26.0 and later.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

ParticipantsCanvas is a responsive component and will switch between regular mode and list mode depending on the size of the container its placed in. Regular mode and list mode contain different children - ParticipantCanvas and ParticipantCanvasListItem respectively. When customizing ParticipantsCanvas children, like adding an additional button, remember to do customization to both children components

Regular mode

ParticipantsCanvas.

List mode

Participant list showing call status and options to mute or remove.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Profile of Felix Marshall with listening status and call controls.

ParticipantCanvasListItem

participantcanvaslistitem page anchor

Direction: Vertical

Participant Felix Marshall is listening with mute and remove options.

WorkersDataTable is a programmable component. It is a Material UI table styled to the Flex theme with data from the Insights SDK.

View Full Component Reference >(link takes you to an external page)

(warning)

Warning

As of flex-ui v1.12.0 new exports were added to refer to workers instead of agents:

  • WorkersDataTable
  • WorkerListFilterSelect
  • WorkersDataTable
  • WorkersDataTableProps
  • WorkerListFilter

For example, AgentsDataTable is now referred to as WorkersDataTable. However, previous exports (like AgentsDataTable) are kept for backwards compatibility

By default, WorkersDataTable contains the following rows:

Add columns to WorkersDataTable

add-columns-to-workersdatatable page anchor

Columns can be added to the table programmatically. Columns cannot be removed yet (the ability to do that is coming soon). You can add columns with different types of content:

  • TaskCardList component
  • Any custom component
  • String

TaskCardList

1
import { TaskCardList, ColumnDefinition } from "@twilio/flex-ui";
2
3
Flex.WorkersDataTable.Content.add(
4
<ColumnDefinition key="calls" header={"My Custom Header"} content={(items, context) => <TaskCardList tasks={items.tasks} />} />);

TaskCardList also has a filter prop which can be used here, and which is optional. If the filter prop is not set, all tasks in the list will be rendered:

1
export interface TaskCardListProps {
2
compareFunction?: (a: TaskData, b: TaskData) => number;
3
filter?: (task: TaskData) => boolean;
4
tasks: TaskData[];
5
}

Any custom component

1
import { ColumnDefinition } from "@twilio/flex-ui";
2
3
Flex.WorkersDataTable.Content.add(<ColumnDefinition key="hello" header={"Helloxxx"} content={<div>hello</div>}/>);

String

You can use Worker attributes as follows:

1
import { ColumnDefinition } from "@twilio/flex-ui";
2
3
Flex.WorkersDataTable.Content.add(<ColumnDefinition key="team" header={"Team"} content={item => item.worker.attributes.team_name}/>);

By default, WorkersDataTable has 2 filters:

  • All agents
  • Active agents - worker with current activity state set of type available

Filters for the Workers Table can be programmatically changed, by defining filters property of WorkersDataTable component

Example of creating a filter to show workers with activity "Break"

With configuration object

1
componentProps: {
2
WorkersDataTable: {
3
filters: [
4
{
5
query: 'data.activity_name == "Break"',
6
text: "Workers on break"
7
}
8
]
9
}
10
},...

With defaultProps API

1
Flex.WorkersDataTable.defaultProps.filters = [
2
{
3
query: 'data.activity_name == "Break"',
4
text: "Workers on break"
5
},...
6
]

Query data schema

data object in the query refers to TaskRouter worker resource. The following attributes on a worker can be used for filters query:

object namedescriptionformat
data.activity_nameworker's current activity friendly nameString
data.attributesworker's attributesKey value pair
data.date_activity_changeddate of the last activity change of the current workerDatetime ISO8601
data.friendly_nameworker's friendly nameString
data.worker_activity_sidworker's current activity sidString
data.worker_sidworker's sidString
data.workspace_sidworker's workspace sidString

Query operators

WorkersDataTable is powered by Twilio Sync and we use Twilio Sync Live Query for filtering of the workers. See Live Query docs for supported query operators.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Task cards showing a phone call from 07823 732 682 and a message from Alan Cooper.

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Phone icon with number 07823 732 682 and duration 2 minutes.

Direction: Horizontal

Profile of agent James Green, online for 6 hours.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Supervisor.TaskCanvas.

Supervisor.TaskCanvasHeader

supervisortaskcanvasheader page anchor

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Supervisor.TaskCanvasHeader.

Supervisor.TaskCanvasTabs

supervisortaskcanvastabs page anchor

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Tabs labeled Call and Info with Info tab highlighted.

Worker directory contains 2 tabs by default:

Examples

Adding tabs and content

1
Flex.Supervisor.TaskCanvasTabs.Content.add(
2
<Flex.Tab key="my-tab" label="My Tab">
3
<div> "Hello World"
4
</div>
5
</Flex.Tab>
6
);

View Full Component Reference >(link takes you to an external page)

Direction: Horizontal

Customer info panel showing contact details and previous interactions for Jean Spencer.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Profile panel with agent details, skills, and adjustable skill levels.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Close button next to profile label on header.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Agent details with email, team EU Sales, and manager Harry Harisson.

View Full Component Reference >(link takes you to an external page)

Direction: Vertical

Skills settings with toggles for Sales and Tech Support, and save and reset buttons.