Justify Content
Use justifyContent prop to control how flex items are aligned on the main axis.
Name | Styles |
|---|---|
center | |
end | |
flex-end | |
flex-start | |
normal | |
space-around | |
space-between | |
start | |
stretch |
#
Documentation
#
#
Usage
#
01
02
03
"use client";
import type { ComponentPropsWithoutRef } from "react";
import { Box, Group, theme } from "@optiaxiom/react";
export function App({
justifyContent = "flex-start",
}: Pick<ComponentPropsWithoutRef<typeof Group>, "justifyContent">) {
return (
<Group
gap="16"
justifyContent={justifyContent}
rounded="md"
style={stripes}
w="full"
>
<DemoBox>01</DemoBox>
<DemoBox>02</DemoBox>
<DemoBox>03</DemoBox>
</Group>
);
}
function DemoBox({ children, ...props }: ComponentPropsWithoutRef<typeof Box>) {
return (
<Box
bg="bg.avatar.purple"
display="grid"
fontFamily="mono"
fontSize="md"
fontWeight="600"
p="16"
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"
justifyContent={["center", "flex-end"]}
rounded="md"
style={stripes}
w="full"
>
<DemoBox>01</DemoBox>
<DemoBox>02</DemoBox>
<DemoBox>03</DemoBox>
</Group>
);
}
function DemoBox({ children, ...props }: ComponentPropsWithoutRef<typeof Box>) {
return (
<Box
bg="bg.avatar.purple"
display="grid"
fontFamily="mono"
fontSize="md"
fontWeight="600"
p="16"
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