@tuv-indo/admin
v1.0.1
Published
TÜV NORD Indonesia admin design system: app shell, components, hooks and utilities
Readme
@tuv-indo/admin
The central admin design system for TÜV NORD Indonesia web apps. It provides the app shell (header, sidebar, page layout), the component library, and shared hooks/utilities in one package. The separate @tuv-indo/* component packages were merged into this one, so apps only need this dependency.
Install
pnpm add @tuv-indo/adminPeer dependencies: react >= 18.2, react-dom >= 18.2, react-router-dom ^6.23.
Usage
import { App, DashboardLayout, PageLayout, Button, useApp } from "@tuv-indo/admin";
import { Outlet, RouterProvider, createBrowserRouter } from "react-router-dom";
const Root = () => {
const app = useApp();
return (
<DashboardLayout logo={app.logo} menus={app.menus} userData={app.userData ?? undefined}>
<Outlet />
</DashboardLayout>
);
};
const router = createBrowserRouter([
{
path: "/",
element: <Root />,
children: [
{ path: "/", element: <PageLayout title="Audits" action={<Button>New audit</Button>} /> },
],
},
]);
<App logo={logo} menus={menus} router={<RouterProvider router={router} />} />;Import the stylesheet once, as the first import of your entry file, before any module that imports CSS: views, routes and components with their own .css load their CSS when they are imported, so importing them first puts your CSS before the kit's, and it loses at the same specificity. The stylesheet holds the CSS of every component; nothing is injected at runtime.
// main.tsx (Vite) or app/layout.tsx (Next.js)
import "@tuv-indo/admin/dist/style.css"; // first; or "@tuv-indo/admin/style.css", the same file
import { App } from "@tuv-indo/admin";
import { router } from "./router"; // views, and their CSS, after itFonts
The kit loads no fonts. Load Poppins once, in the weights the kit uses (300 to 800), for example in index.html:
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap" />Components use the token --tuv-font-family-sans. If the font has another name, as with next/font, point the token at it: :root { --tuv-font-family-sans: var(--font-poppins), sans-serif; }. A different font for part of a page (TNG Pro on a certificate) is set on its container, without !important.
Base styles
style.css starts with a small base in the cascade layer tuv-base:
- a margin and padding reset with
box-sizing: border-box; - the body font and background;
- a keyboard focus ring.
Any CSS your app writes overrides it, Tailwind's layers included, as long as the kit's stylesheet is imported first.
Scrollbars show. The page keeps the browser's own bar, and the kit's scroll areas (lists, dialog bodies, tables, the sidebar) draw a thin neutral one. To hide them, in every browser:
- for the whole app, put
data-tuv-scrollbars="hidden"on<html>; - for one element, and the kit's scroll areas inside it, put
data-tuv-scrollbar="hidden"on it.
In an app with hidden scrollbars, data-tuv-scrollbar="visible" on an element brings its bar back.
Next.js (App Router)
The kit is client code: its entry files start with "use client", so a Server Component can render kit components that take plain props (<Text>, <ToastContainer />). Anything that passes a function, such as DataTable columns with render, goes in your own file that starts with "use client". Import the stylesheet in app/layout.tsx.
The kit's links and navigation use React Router unless you give it Next's router. Do that once, in the "use client" file that holds your App shell:
"use client";
import Link from "next/link";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { DashboardLayout, RouterAdapterProvider, createNextRouterAdapter } from "@tuv-indo/admin";
const adapter = createNextRouterAdapter({ Link, useRouter, usePathname, useSearchParams });
export function AppShell({ children }: { children: React.ReactNode }) {
return (
<RouterAdapterProvider adapter={adapter}>
<DashboardLayout logo={logo} menus={menus} userData={user}>{children}</DashboardLayout>
</RouterAdapterProvider>
);
}react-router-dom must still be installed: it is a peer dependency. examples/next-app shows the whole setup.
Upgrading from 0.0.x
Read CHANGELOG.md, then rename the old names in your app (on a clean git tree, so git diff shows every change):
npx -p @tuv-indo/admin@latest tuv-admin-migrate # report only
npx -p @tuv-indo/admin@latest tuv-admin-migrate --write # applyWhat's inside
| Category | Contents |
|---|---|
| Foundations | Theme, Text, Typography, Icon (360+ icons) |
| Layout | Box, Flex, Card, Section |
| Actions | Button, Menu, Pressable, ActionMenu |
| Forms | Input, Textarea, Dropdown, MultiSelect, Checkbox, Radio, Toggle, TuvDate, InputFile, SelectButton, Form.*, HorizontalField, AdvanceFilter |
| Overlays | Dialog, FormDialog (popup form), Drawer, RightDrawer (side panel), ModalDialog (confirm), Tooltip, Toast |
| Data display | DataTable, Table, TableContainer, Pagination, Badges, Accordion, Tabs, Stepper, StoryRecord, Progress, Alert, Avatar |
| App shell | App, DashboardLayout, Header, Sidebar, ContentLayout, PageLayout, AuthLayout, FloatingFooter, ScrollToTopButton, page states (empty, 403, 404, 500) |
| Utilities | Hooks (useMediaQuery, useDismiss, useModalLayer, …), HTTP client, storage, route hooks, helpers |
The source follows the same folders: src/<category>/<component>/.
Component default copy is English. Every default string can be replaced through props.
Index for AI assistants
The package carries @tuv-indo/admin/meta.json, an index of the kit for AI coding assistants. It holds every docs page (description, props, code, examples), every export, the icon names, the design tokens and the 1.x CHANGELOG. The MCP server mcp-tuv-admin-react reads it from the app's node_modules, so the assistant sees the API of the version the app installed. pnpm build writes it with scripts/gen-meta.mjs. The format is in docs/superpowers/specs/2026-11-23-indeks-mcp.md.
Development
Use pnpm (9.x, matching pnpm-lock.yaml). npm install ignores the lockfile and resolves newer versions than the ones tested, React 19 among them.
pnpm install
pnpm dev # docs site at http://localhost:9003
pnpm test # unit + accessibility tests (Vitest)
pnpm typecheck
pnpm format # Prettier
pnpm build # dist/ (es, cjs, umd + types)Component docs
pnpm dev serves the docs site at http://localhost:9003/docs/, e.g. /docs/button.
Every page has a live preview with its source, installation (pnpm, npm or yarn), usage, examples and an API reference; every code block has a copy button.
- Pages:
dev/docs/pages/<slug>.tsx(routed automatically); sidebar categories and order:dev/docs/registry.ts. - Examples:
dev/docs/examples/<slug>/*.tsx. The Code tab shows the example file itself, so the code always matches the preview. - API tables come from the TypeScript props and their JSDoc (
pnpm docs:props, also run beforepnpm dev). Document a prop by writing a/** … */comment on it. - Page frame, code blocks and tables:
dev/docs/kit.tsxanddev/docs/docs.css.
Publishing the docs site
pnpm docs:build # static site in docs-dist/ (dist/ stays the library)
DOCS_BASE=tuv-admin pnpm docs:build # hosted under a sub-path, e.g. https://host/tuv-admin/
pnpm docs:preview # serve docs-dist/ locally on port 9004Upload docs-dist/ to any static host. Deep links such as /docs/button need the host to fall back to index.html; the build also writes 404.html for hosts that only do that (GitHub Pages). Write DOCS_BASE without a leading slash: Git Bash turns /tuv-admin/ into a Windows path.
.github/workflows/docs.yml builds the site on every push to main and keeps it as the docs-site artifact of the run. It deploys to GitHub Pages only when the repository owner turns Pages on (Source: GitHub Actions) and sets the repository variable DOCS_PAGES=true. A Pages site is public on the internet even when the repository is private, unless the organization has GitHub Enterprise Cloud and publishes it privately.
Releasing
Nothing publishes without the owner. Pushing a version tag (v1.0.0) starts .github/workflows/release.yml: it checks the tag against package.json and CHANGELOG.md, runs CI again, waits for a reviewer's approval, then publishes through npm trusted publishing (no npm token in the repo) and creates the GitHub Release. It needs a one-time setup on npmjs.com and GitHub; publishing by hand stays possible. Both ways, from checks to dist-tags, are in docs/RELEASING.md.
CI (.github/workflows/ci.yml) runs the checks below on every pull request and every push to main, then builds the example apps from the packed tarball. prepublishOnly runs them again and stops a publish when any of them fails:
# Public API must not lose exports compared with the last published version
node scripts/check-exports.mjs --compare scripts/baseline/exports-0.0.165.json
# The package as an app receives it: exports map, "use client", import = require, tarball contents, meta.json
node scripts/check-package.mjs
# Install the packed tarball into the example apps (examples/) and build them
node scripts/pack-examples.mjs
# Docs screenshots must match a saved baseline (pnpm docs:build && pnpm docs:preview running)
BASE_URL=http://localhost:9004 node scripts/check-visual.mjs --compare <baseline-dir>