Pallas UI
DocsComponents
Core Concepts
    • Introduction
    • Getting Started
    • Theming
    • Color Tokens
    • Spacing & Sizing
    • Layout Guide
    • AspectRatio
    • Box
    • Flex
    • Grid
    • Shapes
Previews
    • Accordion
    • Alert
    • Avatar
    • Badge
    • Breadcrumb
    • Button
    • Carousel
    • Checkbox
    • Combobox
    • Command
    • Date Picker
    • Form
    • Input
    • Input OTP
    • Label
    • MenuBar
    • Modal
    • Popover
    • Progress
    • Radio Group
    • ScrollArea
    • Segmented
    • Select
    • Separator
    • Sheet
    • Sidebar
    • Skeleton
    • Slider
    • Spinner
    • Steps
    • Switch
    • Tabs
    • Textarea
    • Toast
    • Tooltip
    • TreeView
    • Typography
  1. Layout
  2. Flex

Flex

A layout component that uses flexbox to help arrange its children in rows or columns with powerful alignment and spacing controls.

Loading preview...

Usage

import { Flex, HStack, VStack } from '@styled-system/jsx'
<Flex 
  direction="row"
  gap="4"
  align="flex-start"
  justify="flex-start"
>
  <Box>Item 1</Box>
  <Box>Item 2</Box>
  <Box>Item 3</Box>
</Flex>

Properties

Flex accepts all common properties mentioned in the layout guide along with these flex-specific properties:

PropertyCSS PropertyDescription
directionflex-directionSets the direction of the flex container: row, row-reverse, column, column-reverse
alignalign-itemsAligns items along the cross axis: flex-start, flex-end, center, baseline, stretch
justifyjustify-contentDistributes space along the main axis: flex-start, flex-end, center, space-between, space-around, space-evenly
wrapflex-wrapControls item wrapping: nowrap, wrap, wrap-reverse
gapgapSets spacing between flex items
basisflex-basisSets the initial main size of a flex item
growflex-growSets the grow factor of a flex item
shrinkflex-shrinkSets the shrink factor of a flex item
flexflexShorthand for flex-grow, flex-shrink, and flex-basis

HStack and VStack Properties

These are specialized Flex components that share the following properties:

PropertyCSS PropertyDescription
directionflex-directionDirection of the flex container (preset per component)
alignalign-itemsAligns items along the cross axis
justifyjustify-contentDistributes space along the main axis
gapgapSets spacing between flex items

Both components also accept all other common properties mentioned in the layout guide.

Examples

Default

Loading preview...

Column Direction

Loading preview...

Alignment Options

Loading preview...

Justify Content

Loading preview...

HStack and VStack

HStack and VStack are specialized Flex components with convenient defaults:

Loading preview...
Loading preview...

Responsive Flex

Loading preview...

Built with ❤️ by the carbonteq team. The source code is available on GitHub.

© 2026 Pallas UI. All rights reserved.

Item 1
Item 2
Item 3
Item 1
Item 2
Item 3
Item 1
Item 2
Item 3
flex-start
Item 2
Item 3
center
Item 2
Item 3
flex-end
Item 2
Item 3
flex-start
Item 2
Item 3
center
Item 2
Item 3
flex-end
Item 2
Item 3
space-between
Item 2
Item 3
Item 1
Item 2
Item 3
Item 1
Item 2
Item 3
This box will be stacked vertically on small screens and horizontally on medium screens and up.
Responsive layout with different gap sizes based on screen width.