Flat, minimal design system for n3wth projects. Built on Tailwind CSS 4 with iOS-inspired aesthetics.
npm install @n3wth/uiimport '@n3wth/ui/styles'Fixed navigation bar with hide-on-scroll behavior. Used across n3wth, skills, and ui sites.
import { Nav } from '@n3wth/ui'
<Nav
logo="n3wth"
logoHref="/"
items={[
{ label: 'Work', href: '#work' },
{ label: 'About', href: '#about' },
{ label: 'GitHub', href: 'https://github.com/n3wth', external: true },
]}
fixed // Position fixed at top
hideOnScroll // Hide on scroll down, show on scroll up
showThemeToggle // Show theme toggle (requires onThemeToggle)
theme="dark"
onThemeToggle={() => {}}
/>Props:
logo- ReactNode for the logologoHref- Link for logo click (default: "/")items- Array of{ label, href, isActive?, external? }fixed- Fixed position at tophideOnScroll- Smooth scroll-based visibilitytheme- "dark" | "light"onThemeToggle- Theme toggle callbackshowThemeToggle- Show/hide theme toggle (default: true)
Alignment: Nav content uses max-w-6xl mx-auto px-6 md:px-12 on the inner container. Ensure your page sections use the same padding pattern for alignment.
When using @n3wth/ui components, add the @source directive to scan component classes:
@import 'tailwindcss';
@import '@n3wth/ui/styles';
/* Required: scan @n3wth/ui for Tailwind classes */
@source "../node_modules/@n3wth/ui/dist";Components use CSS variables for theming. Define these in your :root:
:root {
--color-bg: #000000;
--color-white: #ffffff;
--color-grey-400: #86868b;
--color-accent: #ffffff;
}The @n3wth/ui/styles import provides default values.
All sections should use consistent container styling:
// Page section - padding on inner container to match Nav/Footer
<div className="mx-auto max-w-6xl px-6 md:px-12">
{/* Content */}
</div>
// Nav handles this internally
<Nav fixed hideOnScroll ... />import { Nav, useTheme } from '@n3wth/ui'
function App() {
const { theme, toggleTheme } = useTheme()
return (
<Nav
theme={theme}
onThemeToggle={toggleTheme}
// ...other props
/>
)
}src/
├── atoms/ # Button, Badge, Input, Icon, etc.
├── molecules/ # Card, NavLink, ThemeToggle, MobileDrawer
├── organisms/ # Nav, Hero, Section, Footer
├── hooks/ # useTheme, useMediaQuery, useReducedMotion
├── tokens/ # Design tokens (colors, typography, spacing)
└── styles.css # Global styles and CSS custom properties
Add @source directive to scan @n3wth/ui classes (see Tailwind v4 Integration above).
Ensure :root CSS custom properties are defined, or import @n3wth/ui/styles.
Use matching container constraints: max-w-6xl mx-auto px-6 md:px-12
Publishing is automated via GitHub Actions. Do NOT use npm publish locally.
- Bump version:
npm version patch(or minor/major) - Push:
git push && git push --tags - Create release:
gh release create v$(node -p "require('./package.json').version") --generate-notes - The
.github/workflows/publish.ymltriggers on release creation and publishes to both npm and GitHub Packages
Shortcut: npm run release:patch does all steps at once.
The demo site at https://ui.n3wth.com deploys automatically from the main branch via Vercel.
- Project: Linked to
n3wth/uiGitHub repo - Build: Demo Vite build (
npm run demo:build), outputdist-demo.npm run buildbuilds the npm library. - Auto-deploy: Every push to
maintriggers a new deployment - Preview: PRs get preview deployments automatically
After publishing a new version, update consumers:
newthai(portfolio site) -npm install @n3wth/ui@latestr3(website) -npm install @n3wth/ui@latestinwebsite/
Shared OG image template for n3wth sites. Works with Next.js opengraph-image.tsx:
// app/opengraph-image.tsx
import { ImageResponse } from 'next/og'
import { OGCard } from '@n3wth/ui/og'
export const runtime = 'edge'
export const size = { width: 1200, height: 630 }
export const contentType = 'image/png'
export default function Image() {
return new ImageResponse(<OGCard title="My Site" />, size)
}Black background, white type, n3wth mark. 1200x630, Twitter summary_large_image compatible.
- v0.5.3 - Dependency updates
- v0.5.2 - Consistent width alignment (Nav, Footer, content all use max-w-6xl px-6 md:px-12)
- v0.5.0 - Nav hideOnScroll, alignment fixes, solid background
- v0.4.x - Initial Nav component, NavLink variants
- v0.3.x - Hero, Section, Footer organisms