Skip to content
Ginga UI
Ginga UI
日本語

Getting started

  • Overview
  • Quick start
  • Theme generation
  • Custom rendering
  • All components

Forms

  • Button
  • Checkbox
  • Input
  • Radio
  • Questionnaire
  • SegmentedControl
  • Select
  • ComboBox
  • NumberField
  • SearchField
  • Slider
  • Switch
  • FormControl

Display

  • Accordion
  • Alert
  • AlertDialog
  • Badge
  • CodeBlock
  • Card
  • Dialog
  • Drawer
  • Image
  • List
  • Popover
  • Menu
  • Tooltip
  • Table
  • Tab
  • Toast
  • Trace

Typography

  • Heading
  • Paragraph

Navigation

  • Anchor

Layout

  • Box

Resources

  • Changelog
  • GitHub (opens in a new tab)

Logo: Twemoji (opens in a new tab) (CC-BY 4.0)

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

NameTypeDefaultDescription
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.