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"> <Box p="md" rounded="4" bg="primary" color="white"> Box </Box> <Box p="md" rounded="4" bg="secondary" color="white"> Box </Box> <Box p="md" rounded="4" bg="warning" color="white"> Box </Box> <Box p="md" rounded="4" bg="danger" color="white"> Box </Box> </Flex>
Using Spacer
Editable example
<Flex w="full" gap="md"> <Box p="md" rounded="4" bg="primary" color="white"> Box </Box> <Box p="md" rounded="4" bg="secondary" color="white"> Box </Box> <Spacer /> <Box p="md" rounded="4" bg="warning" color="white"> Box </Box> <Box p="md" rounded="4" bg="danger" color="white"> Box </Box> </Flex>
Edit this page on GitHub