Build your first UI page
@n3wth/ui is a React design system built on Astryx. This page installs the current version and renders a working page with a site layout and a native control.
Prerequisites
Section titled “Prerequisites”- Node.js 24 (declared in the package
enginesfield) - React and React DOM 18 or 19 (peer dependencies)
- A bundler that resolves ESM, package CSS imports, and font URLs. The package includes a Vite starter.
The example below assumes a React TypeScript app with src/main.tsx and an
HTML element with id="root". For Next.js, put interactive components in
a client module and import the CSS through your application’s global
stylesheet entry.
Install and render
Section titled “Install and render”-
Install the package
From your application directory, install
@n3wth/ui. React and React DOM are peer dependencies. GSAP is an optional peer used by animation hooks.Terminal window npm install @n3wth/uiTerminal window pnpm add @n3wth/uiTerminal window yarn add @n3wth/uiIf you are contributing to this repository, follow Workspace setup instead of installing a second registry copy.
-
Render a page
Replace
src/main.tsxwith this example. It mounts a provider, imports the shared stylesheet, and renders a counter with a native Astryx button.import { useState } from 'react'import { createRoot } from 'react-dom/client'import {N3wthProvider,PageHeader,SiteContainer,SiteSection,SiteText,} from '@n3wth/ui/site'import { Button } from '@n3wth/ui/primitives'import '@n3wth/ui/site.css'function App() {const [count, setCount] = useState(0)return (<N3wthProvider mode="dark"><SiteContainer as="main"><PageHeadertitle="Component sandbox"description="Try a native control in the shared site theme."/><SiteSection aria-label="Counter"><Button label="Increment" onClick={() => setCount(value => value + 1)} /><SiteText as="div"><output aria-live="polite">Count: {count}</output></SiteText></SiteSection></SiteContainer></N3wthProvider>)}const root = document.getElementById('root')if (!root) throw new Error('Missing #root element')createRoot(root).render(<App />) -
Run and verify the page
Start the app with its existing development command, such as
npm run devin a Vite app. Open the local URL printed by the server.You should see Component sandbox and Count: 0. Select Increment and confirm the output changes to Count: 1.
N3wthProvidersupplies the theme context.site.csssupplies the generated theme and component CSS. You need both. This example does not require Tailwind utility generation.If the page is unstyled or an import fails, see Troubleshooting.