Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ProjectX UI

Nederlands · English

A fully in-house React component library, built on the ProjectX UI design. It works like shadcn/ui — same composition, same copy-paste approach — but without a single line of code from shadcn, Radix, Headless UI, cva or clsx. Everything lives in packages/ui/src.

181 components · 4 languages · 6 themes · 3 densities · 0 UI dependencies in the core
Category Count For
Basics 12 Button, Badge, Card, Avatar, Icon, Text, Kbd, Skeleton …
Forms 20 Input, Select, Combobox, Toggle, Rating, Fieldset, RichEditor …
Overlays 11 Dialog, AlertDialog, Drawer, Popover, ContextMenu, HoverCard …
Data 13 Table, Chart, Stat, Timeline, MessageThread, Chat, Carousel, Countdown …
Navigation 13 Tabs, Sidebar, BottomNav, Menubar, Fab, Collapsible, FilterPanel …
Dates & scheduling 8 Calendar, WeekSchedule, ResourceColumns, Swimlanes …
Layout 11 AppShell, Workspace, Resizable, ScrollArea, Mockup, Stack/Row/Grid …
Feedback 5 Alert, EmptyState, Indicator, Confetti, PulseDot
Motion 23 Dock, CardCarousel (Fold / Dust), NumberFlow … mostly behind the optional @projectx/ui/motion

Getting started

npm install
npm run dev        # docs site on http://localhost:3000 (or 3001, 3002, ... if 3000 is taken)
Command What it does
npm run dev Starts the documentation site (Next.js 15)
npm run build Generates the registry and builds the site
npm run registry Regenerates registry/, the props tables and the demo index
npm run typecheck TypeScript check on the library, the docs and the tests
npm test Vitest: unit, component and CLI tests (tests/)
npm run test:watch Same, re-running on every change
npm run test:ui Builds the site and clicks through the interactive components in Chrome
npm run test:e2e Playwright: builds the site and checks every component page in all 4 variants, themes, light/dark, mobile and languages (first once: npm run test:e2e:install; without rebuilding: npm run test:e2e:snel)
npm run cli -- <command> Runs the CLI straight from the monorepo

Structure

projectx-ui/
├─ packages/
│  ├─ ui/                 The library
│  │  └─ src/
│  │     ├─ components/   158 components (.tsx + .css per component)
│  │     ├─ motion/       23 components behind @projectx/ui/motion (optional)
│  │     ├─ lib/          cn, variants, Slot, Portal, hooks, positioning, dates
│  │     ├─ icons/        in-house icon set (one path per glyph)
│  │     └─ styles/       tokens.css + base.css + index.css
│  └─ cli/                npx projectx-ui  (init / add / update / list)
├─ apps/
│  └─ docs/               The documentation site with live previews
├─ registry/              Generated: source per component for the CLI
└─ scripts/
   └─ build-registry.mjs  Generates the registry, props tables and demo index

Using it in another project

The CLI is published on npm as projectx-ui, with the registry inside the package. To work against the latest developer instead, link it once from this repo:

cd packages/cli && npm link            # after this, `projectx-ui` works anywhere on your machine
npx projectx-ui init                   # tokens, base CSS and helpers
npx projectx-ui add button card dialog # copy components (+ their dependencies)
npx projectx-ui add --all              # everything at once
npx projectx-ui update                 # update everything + add new components
npx projectx-ui list                   # overview
npx projectx-ui add button --registry https://raw.githubusercontent.com/DafkeDD/ProjectX-UI/main/registry/index.json

The CLI writes to components/ui/ (configurable in projectx-ui.json), rewrites the imports into one flat folder and maintains components/ui/ui.css (CSS imports) and components/ui/index.ts (exports). Import that one file in your global stylesheet and you're done.

update fetches the latest version of everything already in your project, immediately installs the components added to the registry since your last update, and leaves files you changed yourself alone — those are skipped unless you pass --force. Use --dry-run to see beforehand what would happen; --only-installed sticks to what you already have. For this the CLI keeps projectx-ui.lock.json (which components you have + a hash per file) — commit that file.

init also asks whether to install the Claude skill. Say yes and .claude/skills/projectx-ui/SKILL.md is added to your project: Claude Code then knows which components exist, which style your project uses and how to use the CLI. update keeps the skill current (unless you edit it yourself). To skip the question: --skill or --no-skill.


Animation in the core

Overlays ease in and ease out: Dialog, Drawer, Popover, Tooltip and Toast stay in the DOM briefly after closing with data-state="closed", so the CSS can run an exit animation. The usePresence hook in packages/ui/src/lib/hooks.ts handles this — about forty lines, no dependency.

Accordion and Collapsible animate their height with grid-template-rows: 0fr → 1fr. That way the height never has to be measured, and content that changes mid-animation follows along smoothly.

Everything respects prefers-reduced-motion.


Motion layer (optional)

The core of the library has zero dependencies and that stays that way. Next to it sits one folder that does need something: packages/ui/src/motion, with the things that get far too expensive in pure CSS — gestures, exit animations and layout that moves along.

npm i motion            # only needed if you import from it
import { MotionDrawerContent, ReorderList, SendButton } from "@projectx/ui/motion";
Component What it adds
MotionDrawerContent Replaces DrawerContent: spring motion, real exit animation, swipe to close
ReorderList A list you reorder by dragging, with or without a handle
MotionSegmented Same API as Segmented, but the active background slides along
OtpVerification Verification card that checks itself: row → grid → confirmation
PaymentCheckout Card details with a card that writes along and flips for the CVC
UploadButton File field whose button unfolds and fills with the progress
SendButton Folds into a paper plane that flies away
OrderButton A delivery van driving through the button
AddToCartButton Shrinks into a basket the item drops into
ShareButton Fans out to your share channels
DeleteButton A trash can that eats the label

The action buttons share one state machine: useAction (idle → busy → done or error), with a minimum play time so a fast backend doesn't cut the animation short.

motion is listed in package.json as an optional peer dependency: if you import nothing from @projectx/ui/motion, you don't need to install it and it doesn't end up in your bundle.

The CLI keeps that distinction: npx projectx-ui add --all skips this folder, and npx projectx-ui update doesn't install them on its own. You add them deliberately by name or with --with-extras; the CLI then tells you which npm package you still need.

They all respect prefers-reduced-motion: they fade instead of move, and dragging is disabled.


Multilingual documentation site

The docs site runs on next-intl:

apps/docs/i18n/routing.ts      # locales + defaultLocale + localePrefix
apps/docs/i18n/request.ts      # loads messages/<locale>.json per request
apps/docs/i18n/navigation.ts   # Link, redirect, usePathname, useRouter
apps/docs/middleware.ts        # language detection (Next 16 calls this proxy.ts)
apps/docs/messages/*.json      # nl · fr · en · de
apps/docs/app/[locale]/...     # all routes under a locale segment

localePrefix is set to never: the URL stays /docs, and the language comes from the NEXT_LOCALE cookie, otherwise from the Accept-Language header. The language switcher in the top right (components/locale-switcher.tsx) sets that cookie.

To translate a text: add the key to all four messages/*.json files, then use useTranslations("namespace") in a client component or getTranslations("namespace") in a server component.

The metadata, navigation, top bar and homepage are translated. The texts on the documentation pages themselves (introduction, installation, theming, component descriptions in content/catalog.ts) are still hardcoded in Dutch.

Search: press Ctrl+K (Windows/Linux) or ⌘K (Mac) anywhere on the docs site, or click the search button in the top bar. A search window opens in the middle of the screen with every page and component. It is built with CommandDialog and CommandTrigger (components/docs-search.tsx). Shortcut labels follow the device: write "mod" in <Kbd keys={["mod", "K"]} /> and it shows ⌘ on a Mac and Ctrl elsewhere.


Design tokens

All colors come from packages/ui/src/styles/tokens.css — taken exactly from the ProjectX UI design. Components never write a hex value; they only use variables:

--accent: #0d9488;   --surface: #ffffff;   --text: #0f1729;
--green: #16a34a;    --amber: #d97706;     --red: #dc2626;
--r-sm: 8px;         --sh-md: 0 4px 12px rgba(16,23,41,.07);

Changing one token recolors the whole library, in light and dark. Dark mode lives in the same file under [data-theme="dark"].


Themes

Six color themes are generated from scripts/build-themes.mjs into packages/ui/src/styles/themes.css: dafkedd (default), neutraal, oceaan, roos, bos and terra (warm terracotta on #191919 with warm brown #2e211b surfaces). Each has a light and a dark version and its own font and radius.

<html data-palette="oceaan">          <!-- whole page -->
<section data-palette="roos">…</section>  <!-- or just a part -->

In React, ThemeProvider defaultPalette="…" and <PalettePicker /> set and remember it.


Four variants: React or HTML, plain CSS or Tailwind

Every component page on the docs site has two switches: React / HTML and plain CSS / Tailwind CSS.

  • React + plain CSS — packages/ui/src/components/* (the .tsx + .css).
  • React + Tailwind — packages/ui/src/tailwind/*: same API and names, Tailwind v4 classes, cn with tailwind-merge (tailwind/tw.ts). Needs styles/tailwind.css after @import "tailwindcss". Install with npx projectx-ui add button --style tailwind (or init --style tailwind). Every component has a Tailwind version, the motion layer too (tailwind/motion/*). scripts/css-naar-tailwind.mjs converts new component CSS; scripts/compare-tailwind.mjs compares both versions pixel by pixel.
  • HTML — generated by scripts/build-html.mjs by rendering every demo to static markup, for both styles. Interactive parts (overlays, dragging) need their own JS.

In-house primitives (no dependencies)

File Replaces What it does
lib/cn.ts clsx / classnames Merging class names
lib/variants.ts cva Variants → classes
lib/slot.tsx @radix-ui/react-slot The asChild pattern
lib/anchor.ts Floating UI / Popper Positioning with flip + clamp
lib/portal.tsx Radix Portal Rendering into document.body
lib/hooks.ts Radix hooks Controlled state, focus trap, escape, scroll lock, outside click
lib/date.ts date-fns / dayjs Weeks, months, ISO week numbers, parsing and formatting time (Intl, nl-BE)
lib/schedule.ts — Shared calendar model: resources, events, overlap packing, grouping
lib/use-voice.ts react-speech-recognition The browser's speech recognition, with a graceful fallback
lib/image.ts react-easy-crop / browser-image-compression Square-cropping and downsizing photos on a canvas
icons/ lucide / feather In-house icon set, 24×24, stroke-based

Components

Basics — Button, Badge, Chip, Avatar, Card, Text, Separator, Kbd, Skeleton, Spinner, CopyButton, Icon Forms — Input, Textarea, Field, Fieldset, Label, Checkbox, RadioGroup, Switch, Toggle, Select, Combobox, Slider, Rating, OtpInput, FileDrop, RichEditor, Composer, VoiceButton, AvatarUpload, SwatchPicker Overlays — Dialog, AlertDialog (+ useConfirm), Drawer, Popover, HoverCard, DropdownMenu, ContextMenu, Tooltip, Command, Toast, ModalProvider (imperative) Navigation — Tabs, Accordion, Collapsible, Breadcrumb, Pagination, Segmented, Stepper, Toolbar, Menubar, Sidebar, BottomNav, Fab (+ SpeedDial), FilterPanel Dates & scheduling — Calendar, DatePicker, DateRangePicker, TimeField, TimeRangeField, PeriodNav Calendar views — WeekSchedule (time grid), ResourceColumns, Swimlanes, TimeSlotList — one data model Data — Table, ListRow, TaskItem, KeyValueList, Stat, DataPill, Timeline, MessageThread, Chat, Carousel, Countdown, QrCode, Charts (bar / line / donut / sparkline), Progress Feedback — Alert, EmptyState, Indicator, PulseDot, ConfettiBurst Layout — AppShell, Workspace, Resizable, ScrollArea, AspectRatio, Mockup, SectionHeader, EntityHeader, AuthLayout, Stack/Row/Grid, Theme (+ DensityToggle)

Every component: TypeScript, controlled + uncontrolled, ARIA roles, keyboard navigation, visible focus, light + dark.


Conventions

  • Every CSS class starts with lui- — it never clashes with existing styling.
  • One .tsx + one .css per component, always copied together.
  • Sub-components follow the composition you know from shadcn: Dialog / DialogTrigger / DialogContent / DialogHeader / DialogTitle / DialogFooter.
  • Props tables in the docs are generated from the TypeScript source, so they can't go stale.
  • Tailwind v4 only runs as a CSS engine (reset + utilities for your own markup) and is not required.
  • Drag & drop (WeekSchedule) is in-house pointer code: no dnd-kit, no react-beautiful-dnd.
  • Sidebar has a tone="inverted" variant: a dark rail whose colors all come from the existing tokens via color-mix, so it stays within the ProjectX UI palette too.
  • Workspace stacks based on its own width (container query), not the window width.
  • The four calendar views share ScheduleResource and ScheduleEvent from lib/schedule.ts, so switching views requires no conversion of your data.
  • Density lives in a single token: --density. Every height and padding is calc(Npx * var(--density)), so DensityToggle (compact / normal / spacious) scales the whole library without touching a component.
  • Voice (VoiceButton, Composer) runs on the browser's Web Speech API. If the browser doesn't support it, the button disappears or turns grey — you never get a dead button.
  • New components carry isNew: true in apps/docs/content/catalog.ts; that shows the "new" label in the navigation, on the page and in the "New in this version" block.

How it was built

This library was built in fifteen steps (see apps/docs/content/roadmap.ts and the introduction page): foundation → forms & basics → navigation & feedback → overlays → dates & scheduling → data & layout → extras → CLI → multilingual → the gaps from the designs → motion → what shadcn and daisyUI did have → animation in the core → the list completed → everything translated.

Labels per release

isNew and isUpdated in apps/docs/content/catalog.ts belong to a single release, not to a component. On every release: first remove all flags, then label only the components of that release again.


Hosting the docs site

The docs site is a normal Next.js app and runs on any host with Node.js 20 or newer (for example DirectAdmin or cPanel "Setup Node.js App"). next.config.mjs builds a standalone version, so the host needs no npm install.

npm run deploy:pack     # build + deploy/projectx-docs/ and deploy/projectx-docs.zip
npm run deploy:start    # try the package locally on http://localhost:3000

The package contains app.js (the startup file), LEESMIJ.txt and site/ (server, node_modules, static files). On the host:

  1. Upload the zip to the application root (e.g. /home/<user>/projectx-docs) and extract it there.
  2. In the Node.js panel: Node.js version 20 or higher, mode Production, startup file app.js, application URL e.g. docs.example.com (a subdomain or the root of a domain, not a subfolder).
  3. Do not click "Run NPM Install": everything is already in site/.
  4. Restart the app. After an update: upload and extract the new zip, then restart.

Every GitHub release also carries the package as projectx-ui-docs-site-vX.Y.Z.zip.


Tests

Where What
tests/ui/ Hooks and components in jsdom (Vitest + Testing Library)
tests/cli/ The CLI end to end: init, add, update, and whether add --all compiles in strict mode
tests/ui/structuur.test.ts Every component exported and styled, no external deps in the core
scripts/ui-test.mjs Real Chrome on the built site: layout, dragging, animations, hydration

Tests using it.fails with "BEKENDE BUG" (known bug) in their name document bugs that are still open. They pass as long as the bug exists; once it's fixed, the test fails and you switch it to it.

Rule: everything that gets added gets a test.


Branches & releases

Branch Role
developer Where work happens and gets pushed. Every push runs CI (registry check, typecheck, build, tests, browser test).
main Only via a pull request from developer. Every merge automatically creates a GitHub release.

Making a release:

git switch developer
npm run version:patch        # or version:minor / version:major — updates every package.json, the lockfile and the registry
git commit -am "chore: release v0.1.1"
git push

Then open a pull request developer → main and merge it. The workflow .github/workflows/release.yml builds everything, creates tag vX.Y.Z and a release with auto-generated release notes, the registry (projectx-ui-registry-vX.Y.Z.tar.gz) and the CLI package (projectx-ui-X.Y.Z.tgz). If the tag already exists because you forgot to bump the version, the workflow skips the release with a warning.

The CLI on npm

The same workflow publishes that projectx-ui-X.Y.Z.tgz to npm (with provenance), unless that version is already there.

  • First time: on npmjs.com create a granular access token (Read and write, all packages, bypass 2FA, short expiry) and store it in GitHub under Settings → Secrets and variables → Actions as NPM_TOKEN. Without that secret and as long as the package doesn't exist yet, the workflow skips npm with a warning.
  • After the first publish: on npmjs.com open the package → Settings → Trusted Publisher → GitHub Actions, with DafkeDD, ProjectX-UI and release.yml. Then delete the token on npmjs.com and the NPM_TOKEN secret: from then on the workflow publishes via OIDC, without a token.

After the release, bring developer level with main (fast-forward, no extra merge commit):

git switch developer
git pull --ff-only origin main
git push

Ignore GitHub's "main had recent pushes → Compare & pull request" banner: never open a pull request main → developer.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages