Box
A general-purpose container component. The basic building block for layouts.
Installation
import { Box } from "@ginga-ui/core";Basic usage
A simple box example.
A basic Box component. Use it as a container that wraps content.
box.tsx
box.module.css
import { Box } from "@ginga-ui/core";
import styles from "./box.module.css";
export function BasicExample() {
return (
<Box className={styles.basicBox}>
A basic Box component. Use it as a container that wraps content.
</Box>
);
}Layout
A layout example using Flexbox.
Box 1
Box 2
Box 3
box.tsx
box.module.css
import { Box } from "@ginga-ui/core";
import styles from "./box.module.css";
export function LayoutExample() {
return (
<Box className={styles.layout}>
<Box className={styles.layoutItem}>Box 1</Box>
<Box className={styles.layoutItem}>Box 2</Box>
<Box className={styles.layoutItem}>Box 3</Box>
</Box>
);
}Card style
An example of card-like styling.
Card-style Box
Apply styles to the Box component to give it a card-like appearance.
box.tsx
box.module.css
import { Box } from "@ginga-ui/core";
import styles from "./box.module.css";
export function CardStyleExample() {
return (
<Box className={styles.cardStyleBox}>
<h3 className={styles.cardStyleTitle}>Card-style Box</h3>
<p className={styles.cardStyleText}>
Apply styles to the Box component to give it a card-like appearance.
</p>
</Box>
);
}Props
Box
| Name | Type | Default | Description |
|---|---|---|---|
render | (props) => ReactElement | - | Replaces the root element. Return an element that receives the given props, such as next/link. |
Also accepts the attributes of the HTML div (opens in a new tab) element.