A primitive component that can be used to build flexbox based elements and layouts.

yarn add @twilio-paste/flex — or — yarn add @twilio-paste/core


Flex is a layout component that allows you to build flexbox based elements and layouts. These flexible elements and layouts allow your components to adapt to the available space or screen size.

About Flex#

Flex utilizes a simplified flexbox API that allows you more efficient ways to layout, align, and distribute space among elements in a container. The Flex API helps take the confusion out of using flexbox CSS properties, by giving you simple methods to change properties like flex, flex-direction, flex-wrap, and so on.

Flexible elements can adapt to fill space within the layout. This allows Flex to work well for product layouts or elements that change orientation, resize, stretch, or shrink.

The Flex API was created because flexbox can be a difficult CSS property to wrap your head around, which leads to confusion on how it all works. If you’d like to learn more about flexbox, the learning resources below provide further information:


The Flex component is an all purpose component. By default, it has no accessibility concerns. If you use the Flex as a custom element, it is up to you to manage the resulting accessibility implications.


Left area
Right area

Flex Properties#

Left area
Right area

Vertical Property#

Left area
Right area

Wrap Property#

Left area
Right area

Vertical Alignment Properties#

Left area
Right area

Horizontal Alignment Properties#

Left area
Right area

Composition Notes#

The Flex component is used to compose flexible layout experiences. Let's look at an example where we need to build a flexible content layout with two sidebars: its has a left sidebar, a content area, and a right sidebar. Here's how we’ll compose the flexible layout using Flex:

Left sidebar area
Content area
Right sidebar area

When to use Flex#

The Flex component should be used when a flexible layout is needed with a page layout or custom component layout.


Use Flex to layout your page or custom component.


Use Flex to set margins or padding within layouts and components.


Use Flex to build responsive experiences.


Use inline CSS or classNames to add styles that Flex can provide.

Usage Guide#



yarn add @twilio-paste/flex - or - yarn add @twilio-paste/core


import {Flex} from '@twilio-paste/flex';
const Component = () => <Flex>Foo</Flex>;


as?keyof JSX.IntrinsicElementsA custom HTML tagdiv
display?string, ResponsiveValue<'flex', 'inline-flex'>Display property'flex'
basis?string, number, ResponsiveValue<string, number>Flex basis property
grow?boolean, number, ResponsiveValue<boolean, number>Flex grow property
shrink?string, number, ResponsiveValue<string, number>Flex shrink property
hAlignContent?string, number, ResponsiveValue<string, number>Horizontal alignment property
vAlignContent?string, number, ResponsiveValue<string, number>Vertical alignment property
vertical?boolean, number, ResponsiveValue<boolean, number>Flex direction property
wrap?boolean, number, ResponsiveValue<boolean, number>Flex wrap property


If you need support, please open a new issue in our GitHub repository. Please try to provide as much detail as possible in your issue.


The Paste design system is open source and contributions are welcome. Check out the project on GitHub to learn more about contributing.

Copyright © 2020 Twilio, Inc.