AI Assistant

Flex

The Flex component is a flexible container for creating responsive layouts. It's useful for arranging child elements in a row or column, adjusting the gap between them, and controlling alignment.

Responsive Props

Flex adapts to different screen sizes with responsive props like $xsGap and $smJustifyContent. You will see this pattern throughout the Cherry Design System.

import React from "react";
import { Flex, Box } from "cherry-styled-components";

export default function Page() {
  return (
    <Flex $justifyContent="center">
      <Box>Box</Box>
      <Box>Box</Box>
    </Flex>
  );
}

Properties

childrenReact.ReactNode

Flex container content.

$justifyContent"center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly"

Justify content alignment. Also available as responsive variants: $xsJustifyContent, $smJustifyContent, $mdJustifyContent, $lgJustifyContent, $xlJustifyContent, $xxlJustifyContent, $xxxlJustifyContent.

$wrap"wrap" | "nowrap" | "wrap-reverse"

Flex wrap behavior.

$gapnumber | "none"

Gap between flex items. Also available as responsive variants: $xsGap, $smGap, $mdGap, $lgGap, $xlGap, $xxlGap, $xxxlGap.

themeTheme

Cherry theme object.