This library is still in development and is available only for internal usage at VTEX.
Skip to main content

Flex

Version: 0.131.0

Flex

Flex represents a flexbox layout.

Usage

import { Flex, FlexSpacer } from '@vtex/admin-ui'

function Example() {
return (
<Flex>
<Flex justify="center" align="center">
First
</Flex>
<Flex justify="center" align="center">
Second
</Flex>
<Flex justify="center" align="center">
Third
</Flex>
</Flex>
)
}

Composition

NameDescription
FlexThe main wrapper with display: flex and helpful styles shorthand.
FlexSpacerCreates an adjustable space that tunes the spacing between child elements within Flex

Examples

Styling

Use the csx property to add styles.

Loading...

Semantic elements

By default, Flex renders a div element. You can customize it using the as prop.

<Flex as="section">
...
</Flex>

<Flex as="aside">
...
</Flex>

<Flex as="footer">
...
</Flex>

Spacer

You can combine Flex and FlexSpacer to adjust spacing.

Loading...

Accessibility

Be sure that you're using the correct semantic element and aria roles for the behavior you're implementing. You can use the WAI-ARIA Practices to help you.

Props

Flex

Besides the props listed bellow, you can use all the props accepted by the JSX element you defined with as, which is div by default.

NameTypeDescriptionRequiredDefault
directionCSS.flexDirectionSame as flexDirection css property🚫-
wrapCSS.flexWrapSame as flexWrap css property🚫-
basisCSS.flexBasisSame as flexBasis css property🚫-
shrinkCSS.flexShrinkSame as flexShrink css property🚫-
growCSS.flexGrowSame as flexGrow css property🚫-
alignCSS.alignItemsSame as alignItems css property🚫-
justifyCSS.justifyContentSame as justifyContent css property🚫-
orderCSS.orderSame as order css property🚫-
csxStyleObjectLayout styles🚫-

FlexSpacer

All props of div JSX element.

NameTypeDescriptionRequiredDefault
csxStyleObjectLayout styles🚫-