A responsive flex container component for vertical stacking with customizable gaps.
import { Flex } from '@backstage/ui';
<Flex />| Prop | Type | Default | Responsive |
|---|---|---|---|
| align | startcenterendbaselinestretch | - | Yes |
| direction | rowcolumnrow-reversecolumn-reverse | - | Yes |
| justify | startcenterendbetween | - | Yes |
| children | ReactNode | - | No |
| className | string | - | No |
| style | CSSProperties | - | No |
The grid component also accepts all the spacing props from the Box component.
| Prop | Type | Default | Responsive |
|---|---|---|---|
| p | 0.511.5234567891011121314string | - | Yes |
| px | 0.511.5234567891011121314string | - | Yes |
| py | 0.511.5234567891011121314string | - | Yes |
| pt | 0.511.5234567891011121314string | - | Yes |
| pr | 0.511.5234567891011121314string | - | Yes |
| pb | 0.511.5234567891011121314string | - | Yes |
| pl | 0.511.5234567891011121314string | - | Yes |
| m | 0.511.5234567891011121314string | - | Yes |
| mx | 0.511.5234567891011121314string | - | Yes |
| my | 0.511.5234567891011121314string | - | Yes |
| mt | 0.511.5234567891011121314string | - | Yes |
| mr | 0.511.5234567891011121314string | - | Yes |
| mb | 0.511.5234567891011121314string | - | Yes |
| ml | 0.511.5234567891011121314string | - | Yes |
A simple example of how to use the Flex component.
<Flex gap="md">
<Box>Hello World</Box>
<Box>Hello World</Box>
<Box>Hello World</Box>
</Flex>The Flex component also supports responsive values, making it easy to create responsive designs.
<Flex gap={{ xs: 'xs', md: 'md' }}>
<Box>Hello World</Box>
<Box>Hello World</Box>
<Box>Hello World</Box>
</Flex>The Flex component also supports responsive alignment, making it easy to create responsive designs.
<Flex align={{ xs: 'start', md: 'center' }}>
<Box>Hello World</Box>
<Box>Hello World</Box>
<Box>Hello World</Box>
</Flex>Our theming system is based on a mix between CSS classes, CSS variables and data attributes. If you want to customise this component, you can use one of these class names below.
bui-Flex0.8.0 - Added support for data attributes in <Box />, <Container />, <Flex />, and <Grid /> components, ensuring they are correctly applied to the rendered elements. #313740.7.1 - Add missing class for flex: baseline #310130.7.1 - Add missing class for flex: baseline #310130.5.0 - Add min-width: 0; by default on Flex components to support truncated text. #301680.5.0 - Fixes spacing props on layout components #300130.4.0 - Fix spacing props on all layout components #300130.2.0 - Merge Stack + Inline into Flex #28634