npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kode4/react-foundation

v0.10.0

Published

Typed router, themed UI component library, and design system for kode4 projects.

Readme

@kode4/react-foundation

A typed application foundation for React: a typed router that turns route definitions into the app's single source of truth, a themed UI component library, and a CSS-variable design system — built to be consumed by humans and by AI agents.

  • Typed router as the app spine — declare each route once with defineRoute (path, Zod-validated params/search, loader, typed action, eager or lazyComponent code-split component, document title, menu/tabs metadata); the library derives the React Router v7 config plus typed links (TypedLink with prefetch/viewTransition, pathTo), menus, breadcrumbs, guards via chain(), scroll restoration (window + inner containers), an aria-live route announcer, a designed 404 (notFoundRoute), and onNavigate/onError observability seams.
  • UI component library — 70+ components on Radix primitives (shadcn/ui as the blueprint): the full input family (incl. PasswordInput, OTPInput, TagInput, NumberInput, Rating, MaskInput, ComboBox), date/time pickers with a partial-aware value model + DateRangePicker, rich editors (MarkdownEditor, HtmlEditor, SignaturePad), media (Gallery, Video, ZoomImage), a multi-step Wizard (branching, persistence, per-step loaders), EmptyState, DataTable (sorting, pagination, row selection, column visibility, global filter, pinning/resizing, per-column filters, row expanding + grouping/aggregation, CSV export + a virtualization recipe — client or server mode, over TanStack Table), data display (Stat, Timeline, TreeView, CodeBlock, MarkdownViewer), split panes (Resizable), a windowed VirtualList, and the layout frames/nav chrome (AppLayout, TopBar, NavigationMenu, SideBar, Breadcrumbs, Hero, …).
  • Forms layer — react-hook-form + Zod with 20+ form-bound …Field components (label/description/error wired for you), WizardForm for multi-step forms, and a busy-gate for async fields like uploads.
  • Charts — LineChart/BarChart/PieChart/ScatterChart/RadarChart and an axis-less Sparkline over recharts, colored by design tokens (dark mode included).
  • File uploads — a headless upload layer (progress, cancel, hashing, dedupe, upload-handle model) behind FileField/ImageField (with cropper).
  • App utilities — SSR-guarded hooks (useMediaQuery, useReducedMotion, useDebouncedValue, useDisclosure, useLocalStorage, useHotkeys, …), an app-wide activity registry for one shared progress bar (ActivityProvider), full-screen effects (screenEffect.confetti() with <ScreenEffects />), and an IconProvider for swapping the built-in glyphs.
  • Design system — semantic CSS-variable tokens (shadcn standard names) with light/dark mode; re-theme everything without a rebuild, no Tailwind required in your app. Built-in label layer (I18nProvider) for i18n with no framework dependency.
  • A11y + tests as a posture — every component is axe-checked in the unit suite, with Playwright end-to-end and pixel visual-regression suites over the showcase demo.

Quick start

Scaffold a ready-wired app (Vite + React + TS, provider stack, typed router, locale routing, sample routes):

npm create @kode4/react-foundation@latest my-app
cd my-app && npm install && npm run dev

Or add the library to an existing app:

npm install @kode4/react-foundation
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { Outlet, RouterProvider } from 'react-router-dom';
import { createAppRouter, defineRoute, ThemeProvider, Toaster } from '@kode4/react-foundation';
import '@kode4/react-foundation/styles.css'; // once, near the app root

const HomePage = () => <h1>Home</h1>;
const Shell = () => <Outlet />; // your chrome (AppLayout, TopBar, …) goes here

const homeRoute = defineRoute({ index: true, component: HomePage, title: 'Home' });
const shellRoute = defineRoute({ component: Shell, children: [homeRoute] });

const queryClient = new QueryClient();
// The second argument is the AppContext every loader receives; extend it via
// `declare module '@kode4/react-foundation/router/context'`.
const router = createAppRouter([shellRoute], { queryClient });

export const App = () => (
	<ThemeProvider>
		<QueryClientProvider client={queryClient}>
			<RouterProvider router={router} />
			<Toaster />
		</QueryClientProvider>
	</ThemeProvider>
);

The full bootstrap (providers, menus, guards, theming) is in docs/INSTRUCTIONS.md.

If you are an AI agent building an app on this library, read docs/INSTRUCTIONS.md first — it is written for you. It is the complete consumer contract: the mental model, the typed-router patterns, the component catalog with props and idioms, theming, data/forms recipes, and the pitfall checklist. Follow it and the app comes out idiomatic, type-safe, and themeable.

Documentation

These consumer docs ship inside the npm package, so the links below resolve from node_modules/@kode4/react-foundation:

  • docs/INSTRUCTIONS.md — start here. The consumer contract: read it when building or extending an app on the library (router, catalog, theming, data, forms, uploads, effects, errors, testing).
  • docs/DESIGN-SYSTEM.md — the theming/token contract: read it when restyling — every token, the -foreground convention, fonts, light/dark mechanics.
  • docs/combo-box.md — the ComboBox living spec: read it when working with async sources, value modes, or creatable selects.
  • docs/date-picker.md — the date/time design contract: read it when you need the partial-aware value model, ranges, or bounds explained in depth.
  • docs/gallery.md — the Gallery carousel/lightbox living spec: read it when composing galleries, slideshows, or the lightbox.

Package entry points

import { Button, defineRoute, useRoute } from '@kode4/react-foundation';
import '@kode4/react-foundation/styles.css'; // batteries-included styles, once near the app root

// Module augmentation target for your app's route context:
declare module '@kode4/react-foundation/router/context' {
	/* extend AppContext */
}

The package is graph-splittable: with a tree-shaking bundler you pay only for the components you import (per-component CSS included), while ./styles.css remains the single batteries-included stylesheet. See docs/INSTRUCTIONS.md §2.1–2.2.

Stability & support

This section describes the promise as it stands today, at 0.10.x. The authoritative text is the stability policy in CHANGELOG.md, which ships inside this package.

Versioning

The package is pre-1.0. The commitment is about how breaking changes arrive, not a promise that none will:

| Bump | May break? | | --------------------------- | ----------------------------------------------------- | | Patch (0.10.0→0.10.1) | No. Fixes, warnings, docs, widened dep ranges. | | Minor (0.10.x→0.11.0) | Yes, always with a ### Breaking migration note. | | Major | Reserved for 1.0.0, once the API is worth freezing. |

Patch upgrades are always safe to take. Minor upgrades are safe to take after you read CHANGELOG.md. A minor that breaks something without a migration note is a bug. Please report it.

Pinning. On 0.x, npm's caret does not cross minors: ^0.10.0 and ~0.10.0 both mean >=0.10.0 <0.11.0, so you get patches only. Moving to a new minor is always a deliberate edit to package.json, and that is the moment to read the changelog. If you really want minors to arrive automatically, use an explicit range such as >=0.10.0 <1.0.0.

What counts as public API

A change to any of the following is never made in a patch. When it breaks something, it comes with a ### Breaking note:

  • Everything exported from the package root (@kode4/react-foundation). That covers components, hooks, functions, and the exported types, including every component's …Props type and the Labels contract of I18nProvider.
  • The rendered contract: the element and ARIA role a component renders, its keyboard behaviour, and its default look.
  • @kode4/react-foundation/router/context, the module you augment to type AppContext.
  • @kode4/react-foundation/styles.css, the single bundled stylesheet.
  • The theming contract: every design token in docs/DESIGN-SYSTEM.md, the k4-* BEM class names (block, __element, --modifier), the @layer k4 cascade layer, and the data-* attributes the docs name as styling hooks.

These are not public API:

  • Anything that is not exported from the package root. The package's exports map is closed, so the internal modules (including internal/) and the file layout inside the package cannot be imported, and file names like Button2.js may change in any release.
  • The inside of a component. A minor may restructure a component's DOM or rewrite the declarations behind its classes. When that changes the default look, the change is listed under ### Breaking. Token overrides survive such changes. Structural overrides written against BEM classes work, but you have to re-check them on each upgrade (docs/INSTRUCTIONS.md §2.2).
  • Dev-only console warnings. A patch may add new ones. They never fire in a production build.

For translations, type them as LabelsOverrides (deep-partial and deep-merged) and not as the full Labels type. With LabelsOverrides, a key added in a later release falls back to its English default instead of breaking your build.

Supported environments

  • React 19 (react/react-dom peer ^19.0.0). React 18 is not supported.
  • The other peers (react-router-dom 7, zod 4, TanStack Query 5, and the CodeMirror/TipTap cores the editors share) are published with the minimum versions the library is built against. The exact ranges are in this package's package.json under peerDependencies. Modern npm installs peers for you. Keep each one to a single copy: duplicate CodeMirror or ProseMirror cores break the editors.
  • A bundler. The package is ESM-only and resolves with moduleResolution: "bundler". It is built and tested with Vite. Other tree-shaking bundlers are expected to work but are not yet tested.
  • Modern evergreen browsers. In practice the floor is Chrome/Edge 111, Safari 16.4 and Firefox 128. The shipped CSS relies on cascade layers and oklch() colours, and the JS targets the same baseline. Chromium and WebKit (including iPhone emulation) are exercised in end-to-end tests. Firefox is not yet. Phone and tablet touch support is a standing requirement for every component.
  • Client-side rendering. The library is a client SPA. It can be imported and rendered under Node, but server rendering and hydration are not supported yet. See the Rendering stance in docs/INSTRUCTIONS.md.

Links

  • Changelog — CHANGELOG.md (ships with the package)
  • Website — https://react-foundation.kode4.de
  • Source — https://gitlab.com/kode4/react-foundation (currently private, so the link asks you to sign in)
  • Report a bug — https://gitlab.com/kode4/react-foundation/-/issues (same restriction for now)

License: MIT.