Display
Use display prop to control the display type of an element.
Name | Styles |
|---|---|
block | |
flex | |
grid | |
inline | |
inline-block | |
inline-flex | |
none | |
table | |
table-cell | |
table-row |
#
Documentation
#
#
Usage
#
01
02
03
04
import type { ComponentPropsWithoutRef } from "react";
import { Box } from "@optiaxiom/react";
export function App() {
return (
<Box display="flex" gap="16">
<DemoBox>01</DemoBox>
<DemoBox>02</DemoBox>
<DemoBox>03</DemoBox>
<DemoBox>04</DemoBox>
</Box>
);
}
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>
);
}#
Responsive
#
import type { ComponentPropsWithoutRef } from "react";
import { Box } from "@optiaxiom/react";
export function App() {
return (
<Box display={["none", "flex"]} gap="16">
<DemoBox>01</DemoBox>
<DemoBox>02</DemoBox>
<DemoBox>03</DemoBox>
<DemoBox>04</DemoBox>
</Box>
);
}
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>
);
}Last updated on