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)

Quick Start

A short guide to getting started with Ginga UI. You can start using its UI components in just three steps.

1. Installation

Install Ginga UI with your package manager.

pnpm add @ginga-ui/core

If you use npm or yarn:

npm install @ginga-ui/core
# or
yarn add @ginga-ui/core

2. Import CSS variables

Each component's CSS is loaded automatically when you import it. In your root component, import only the theme's CSS variable definitions. With the Next.js App Router, add this to layout.tsx.

app/layout.tsx
import "@ginga-ui/core/variables.css";

3. Use components

Import components from @ginga-ui/core and use them.

import {
  Button,
  Card,
  Dialog,
  DialogTitle,
  DialogTrigger,
  Heading,
  Modal,
} from "@ginga-ui/core";

export default function App() {
  return (
    <Card>
      <Heading level={2}>My first Ginga UI app</Heading>
      <DialogTrigger>
        <Button variant="filled">Click me</Button>
        <Modal>
          <Dialog>
            <DialogTitle>Clicked!</DialogTitle>
            <Button slot="close">Close</Button>
          </Dialog>
        </Modal>
      </DialogTrigger>
    </Card>
  );
}

Complete example with the Next.js App Router

A complete setup example for the App Router in Next.js 13 and later.

app/layout.tsx
app/page.tsx
import { ThemeClient } from "@ginga-ui/utils";
import "@ginga-ui/core/variables.css";
import "./globals.css";

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  // Generate a theme on the server (optional)
  const themeClient = new ThemeClient({ provider: "openai" });
  const result = await themeClient.generateTheme("Modern and clean design");

  return (
    <html lang="en">
      <body>
        {result.type === "success" && <style>{result.CSSCode}</style>}
        {children}
      </body>
    </html>
  );
}

Replacing the rendered element

Every component accepts render. Pass a function to draw the element with another component such as next/link while keeping its styles and behavior.

import { Anchor } from "@ginga-ui/core";
import NextLink from "next/link";

export function DocsLink() {
  return (
    <Anchor href="/docs" render={(props) => <NextLink {...props} />}>
      Docs
    </Anchor>
  );
}

See Custom rendering for the requirements and which element is replaced.

Next steps

  • Browse all components to explore the available UI parts
  • Try theme generation to see AI-powered styling in action
  • Check each component's page for usage details and variations