Flex
Flex
is a component that sets flex
to Box
. Also, convenient style shorthand is available.
Import
import { Flex } from "@yamada-ui/react"
Usage
The shorthand provided in Flex
is as follows:
direction
: This is a shorthandprops
forflexDirection
.wrap
: This is a shorthandprops
forflexWrap
.basis
: This is a shorthandprops
forflexBasis
.grow
: This is a shorthandprops
forflexGrow
.shrink
: This is a shorthandprops
forflexShrink
.align
: This is a shorthandprops
foralignItems
.justify
: This is a shorthandprops
forjustifyContent
.
In addition to the shorthand, you can also pass verbose props
.
Editable example
<Flex gap="md"> <For each={["primary", "secondary", "warning", "danger"]}> {(bg, index) => ( <Box key={index} p="md" rounded="4" bg={bg} color="white"> Box </Box> )} </For> </Flex>
Using Spacer
Editable example
<Flex w="full" gap="md"> <For each={["primary", "secondary"]}> {(bg, index) => ( <Box key={index} p="md" rounded="4" bg={bg} color="white"> Box </Box> )} </For> <Spacer /> <For each={["warning", "danger"]}> {({ p, rounded, bg, color }, index) => ( <Box key={index} p="md" rounded="4" bg={bg} color="white"> Box </Box> )} </For> </Flex>
Edit this page on GitHub