@explainer/ui

The @explainer/ui package provides shared React UI components used across the docs, blog, and website apps. It is built on Radix UI, CVA (Class Variance Authority), and Tailwind CSS.

Components

ComponentDescription
ButtonStyled button with variants (default, outline, ghost, link) and sizes
CardContent container with CardHeader, CardTitle, CardDescription, CardContent, CardFooter subcomponents
DropdownMenuAccessible dropdown built on Radix UI with trigger, content, items, separators
ThemeToggleDark/light/system theme switcher persisted in localStorage
NavbarTop navigation bar with app links, project/version switchers, and mobile menu
MobileMenuResponsive sidebar menu for mobile viewports
LocaleSwitcherLocale dropdown for switching between available languages
MobileNavLinksNavigation links adapted for mobile layout

Installation

The package is already included in the monorepo workspace. Import components directly:

import { Button, Card, ThemeToggle, Navbar } from '@explainer/ui'

Utilities

ExportDescription
cn(...classes)Merges class names using clsx + tailwind-merge
buttonVariantsCVA variants config for the Button component
getAppLinks(env)Resolves app navigation links from environment variables
defaultAppLinksDefault app links (Home, Docs, Blog)

The navbar uses getAppLinks() to resolve cross-app navigation URLs from environment variables:

import { getAppLinks } from '@explainer/ui'

const links = getAppLinks({
  PUBLIC_WEBSITE_URL: 'https://explainer.dev',
  PUBLIC_DOCS_URL: 'https://docs.explainer.dev',
  PUBLIC_BLOG_URL: 'https://blog.explainer.dev',
})