Skip to content

Get started

Installation

OG UI is CSS classes that read a theme contract, plus a 3 KB script for the few behaviours HTML can't do alone. Pick one way in.

The CLI copies themes and components into your project, so you own the code, like shadcn/ui.

bash
npx @og-ui/cli init                 # default theme + base styles + og-ui/index.css
npx @og-ui/cli add button dialog    # component CSS
npx @og-ui/cli add tabs --react     # plus the React source
npx @og-ui/cli theme glass          # another theme; switch with data-og-theme="glass"

Then import og-ui/index.css once, in your root layout or main file. The CLI keeps files you have changed unless you pass --overwrite.

Or with the shadcn CLI

Every item is in shadcn's registry format, so the shadcn CLI installs it too:

bash
npx shadcn add https://ui.ogom.in/r/og-ui.json
npx shadcn add https://ui.ogom.in/r/button.json

Or from npm

bash
npm i @og-ui/tokens @og-ui/core
js
import '@og-ui/tokens/themes.css';   // all seven themes
import '@og-ui/core/og-ui.css';      // every component
import { initOgUI } from '@og-ui/core/og-ui.js';
initOgUI();                          // keyboard for menus and tabs, sliders, toasts

React

bash
npm i @og-ui/react @og-ui/core @og-ui/tokens
tsx
// app/layout.tsx (Next.js app router)
import '@og-ui/tokens/themes.css';
import '@og-ui/core/og-ui.css';
import { ThemeProvider } from '@og-ui/react';

export default function RootLayout({ children }) {
  return (
    <html lang="en" data-og-theme="clean">
      <body><ThemeProvider theme="clean">{children}</ThemeProvider></body>
    </html>
  );
}

The components are thin, typed wrappers over the same classes. They forward refs, pass native props through and are safe to render on the server.

Pick a theme and mode

Set attributes on <html> (or any element, to theme one section):

html
<html data-og-theme="glass" data-og-mode="dark" data-og-density="compact">
  • data-og-theme: clean (default), glass, liquid-glass, neumorphism, clay, brutal, aurora
  • data-og-mode: light, dark, or leave it out to follow the system
  • data-og-density: comfortable (default) or compact
  • --og-accent: any colour re-tints every theme, e.g. style="--og-accent: #0ea5e9"