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.
@import "tailwindcss";
@import "@somnia-chain/ui/theme.css";import { ExplorerShell } from "@somnia-chain/explorer-sidebar"
import "@somnia-chain/explorer-sidebar/styles.css"Get started
Four steps
- 01
Install
Both packages live in this repo's npm workspace. Product repos install them the same way once they're published.
bashnpm install @somnia-chain/ui @somnia-chain/explorer-sidebar - 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"; - 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.
tsximport { 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> - 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.
tsximport { 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.
Actions
Status
Layout
Data
Content
Docs
Brand