Somnia Design System

One system for the platform site and the explorer

Tokens, tones and React components extracted from somnia.network and the Somnia Explorer, plus the explorer sidebar that every product page embeds.

globals.css
css
@import "tailwindcss";
@import "@somnia-chain/ui/theme.css";
layout.tsx
tsx
import { ExplorerShell } from "@somnia-chain/explorer-sidebar"
import "@somnia-chain/explorer-sidebar/styles.css"
@somnia-chain/ui33 documented components, the paper, ink and violet tones, and the light and dark app themes.@somnia-chain/explorer-sidebarThe explorer's sidebar, chain picker, top bar and shell, self-styled so any product app can embed it.This siteEvery preview below is a real file under design/examples, rendered live and shown as source.

Get started

Four steps

  1. 01

    Install

    Both packages live in this repo's npm workspace. Product repos install them the same way once they're published.

    bash
    npm install @somnia-chain/ui @somnia-chain/explorer-sidebar
  2. 02

    Import the theme

    After Tailwind, in your global stylesheet. It adds the tokens, tones and utilities, and points Tailwind at the components' classes.

    css
    @import "tailwindcss";
    @import "@somnia-chain/ui/theme.css";
  3. 03

    Set fonts and theme in the root layout

    The theme reads --font-inter, --font-inter-tight and --font-source-code. ThemeBootstrap applies the saved light or dark choice before first paint.

    tsx
    import { ThemeBootstrap } from "@somnia-chain/ui"
    import { Inter, Inter_Tight, Source_Code_Pro } from "next/font/google"
    
    const inter = Inter({ subsets: ["latin"], variable: "--font-inter" })
    // …Inter_Tight as --font-inter-tight, Source_Code_Pro as --font-source-code
    
    <html data-theme="light" suppressHydrationWarning className={inter.variable /* + the others */}>
      <head>
        <ThemeBootstrap />
      </head>
  4. 04

    Use components

    Import from @somnia-chain/ui/next in Next.js apps so internal links use next/link; @somnia-chain/ui works anywhere React does.

    tsx
    import { Button, Panel, PanelHeader, StatBand } from "@somnia-chain/ui/next"
    
    <Panel>
      <PanelHeader eyebrow="Oracle" title="Questions" />
      <StatBand stats={[{ label: "Resolved", value: "66,585", tone: "up" }]} />
    </Panel>

Foundations

Color, type, tone and size

Components

33 components, one API

The site and the explorer each had their own Button, FeatureGrid, CodeBlock and LiveDot. Each pair is now one component with a size or density switch.

The Somnia Explorer runs on both packages.Open the explorer →