Skip to Content
Align Self

Align Self

Use alignSelf prop to control how individual flex items are aligned on the cross axis.

Name

Styles

center
end
normal
start
stretch

#

Documentation

#

Usage

01
02
03
"use client"; import type { ComponentPropsWithoutRef } from "react"; import { Box, Group, theme } from "@optiaxiom/react"; export function App({ alignSelf = "center", }: Pick<ComponentPropsWithoutRef<typeof Group>, "alignSelf">) { return ( <Group gap="16" h="224" rounded="md" style={stripes} w="full"> <DemoBox flex="1" p="64"> 01 </DemoBox> <DemoBox alignSelf={alignSelf} flex="1" p="32"> 02 </DemoBox> <DemoBox flex="1" p="64"> 03 </DemoBox> </Group> ); } function DemoBox({ children, ...props }: ComponentPropsWithoutRef<typeof Box>) { return ( <Box bg="bg.warning.light" display="grid" fontFamily="mono" fontSize="md" fontWeight="600" placeItems="center" rounded="sm" {...props} > {children} </Box> ); } const stripes = { backgroundColor: theme.colors["bg.secondary"], backgroundImage: ` linear-gradient( 135deg, ${theme.colors["bg.avatar.neutral"]} 10%, transparent 0, transparent 50%, ${theme.colors["bg.avatar.neutral"]} 0, ${theme.colors["bg.avatar.neutral"]} 60%, transparent 0, transparent ) `, backgroundSize: "7px 7px", };

#

Responsive

"use client"; import type { ComponentPropsWithoutRef } from "react"; import { Box, Group, theme } from "@optiaxiom/react"; export function App() { return ( <Group gap="16" h="224" rounded="md" style={stripes} w="full"> <DemoBox flex="1" p="64"> 01 </DemoBox> <DemoBox alignSelf={["stretch", "center"]} flex="1" p="32"> 02 </DemoBox> <DemoBox flex="1" p="64"> 03 </DemoBox> </Group> ); } function DemoBox({ children, ...props }: ComponentPropsWithoutRef<typeof Box>) { return ( <Box bg="bg.warning.light" display="grid" fontFamily="mono" fontSize="md" fontWeight="600" placeItems="center" rounded="sm" {...props} > {children} </Box> ); } const stripes = { backgroundColor: theme.colors["bg.secondary"], backgroundImage: ` linear-gradient( 135deg, ${theme.colors["bg.avatar.neutral"]} 10%, transparent 0, transparent 50%, ${theme.colors["bg.avatar.neutral"]} 0, ${theme.colors["bg.avatar.neutral"]} 60%, transparent 0, transparent ) `, backgroundSize: "7px 7px", };
Last updated on