Flex
Flex is a component that sets flex to Box. Also, convenient style shorthand is available.
<Flex gap="md">
{Array.from({ length: 4 }).map((_, index) => (
<Box key={index} bg="bg.contrast" color="fg.contrast" p="md">
Box
</Box>
))}
</Flex>
Usage
import { Flex } from "@yamada-ui/react"
import { Flex } from "@/components/ui"
import { Flex } from "@workspaces/ui"
<Flex />
Direction
<Flex direction="column" gap="md">
{Array.from({ length: 4 }).map((_, index) => (
<Box key={index} bg="bg.contrast" color="fg.contrast" p="md">
Box
</Box>
))}
</Flex>
Align
<Flex align="center" gap="md">
<For each={["sm", "md", "lg"]}>
{(p, index) => (
<Box key={index} bg="bg.contrast" color="fg.contrast" p={p}>
Box
</Box>
)}
</For>
</Flex>
Justify
<Flex justify="space-between" gap="md">
{Array.from({ length: 4 }).map((_, index) => (
<Box key={index} bg="bg.contrast" color="fg.contrast" p="md">
Box
</Box>
))}
</Flex>
Wrap
<Flex wrap="wrap" gap="md" maxW="xs">
{Array.from({ length: 4 }).map((_, index) => (
<Box key={index} bg="bg.contrast" color="fg.contrast" p="md">
Box
</Box>
))}
</Flex>
Use spaces
<Flex w="full" gap="md">
<Box bg="bg.contrast" color="fg.contrast" p="md">
Box
</Box>
<Spacer />
<Box bg="bg.contrast" color="fg.contrast" p="md">
Box
</Box>
</Flex>
Props
Similar Components
Bleed
Bleed is a component used to extend elements beyond the boundaries of a container.
Box
Box is the most abstract component on which all other components are built. By default, it renders a div element.
Center
Center is a component that aligns the child elements in the center within the component.
Container
Container is a component used as a general division element. By default, it renders the section element.
Float
Float is a component used to fix elements to the edges of a container.
Grid
Grid is a component for managing grid layouts. It also comes with handy style shorthand.
Group
Group is a component that groups and attaches multiple elements together.
HStack
HStack is used to stack child elements horizontally.