Skip to content

About

Design system for data-dense apps

Resources

Stars

9 stars

Watchers

0 watching

Forks

Latest commit

 

History

412 Commits

Folders and files

Repository files navigation

Density UI

  • Density provides CSS foundations and controlled React components for data-dense interfaces.
  • One private, versioned density-ui archive contains compiled ESM, declarations, CSS, metadata, optional lint plugins, and a consumer skill.
  • Registry publication is not required.

Install a local snapshot

  • Sign in to GitHub with read access and download density-alpha from the latest successful default-branch CI run that has the artifact.
  • Unzip it and follow the installation guide to install the .tgz in your project.

React applications declare React and ReactDOM compatible with the package's peer ranges. Import the styles once at the application entry in this order:

import "density-ui/core.css";
import "density-ui/themes.css";
import "density-ui/react.css";
import { useState } from "react";
import { Button, Input, View } from "density-ui/react";
import type { DensitySize } from "density-ui/core";

export function Search() {
  const [value, setValue] = useState("");
  return (
    <View>
      <Input value={value} onValueChange={setValue} />
      <Button onClick={() => setValue("")}>Clear</Button>
    </View>
  );
}
  • Core-only applications import density-ui/core.css, followed by density-ui/themes.css for every built-in theme or a chosen standalone theme.
  • Core JavaScript imports do not load React, component code, browser globals, or lint tools.
  • JavaScript imports never apply the global reset implicitly.
  • Core CSS includes the normalize reset, shared mechanics, and primitives; density-ui/themes.css loads all built-in theme definitions separately.
  • React CSS contains component anatomy styles.
  • Check integration with existing global styles, nested theme scopes, and portals; size and emphasis do not inherit across portals.

Public modules

  • Use explicit entrypoints; there is no root component barrel.

  • density-ui/core: attribute values and types.

  • density-ui/react: components, props, chart types, and browser-safe helpers.

  • density-ui/react/component-api: version-matching metadata, annotations, and adapters.

  • density-ui/theme: concrete theme IDs, palette metadata, exact variable types, and declared contrast relationships.

  • density-ui/themes/density-{theme}.css: standalone palettes for modern, one-dark, solarized, gruvbox, dracula, catppuccin, nord, and studio, each with -light and -dark suffixes; density-acid-dark.css supplies Acid dark, density-redmond-95.css supplies Redmond 95 light, and density-sculpted-dark.css supplies Sculpted dark.

  • density-ui/theme/validate: non-rendering CSS theme validation; density-theme-check exposes the same checks as a CLI.

  • density-ui/core.css and density-ui/themes.css: Core mechanics and all theme definitions.

  • Import both in that order.

  • React CSS is separate.

  • density-ui/eslint/core and density-ui/eslint/react: optional ESLint plugins.

  • density-ui/stylelint: optional Stylelint plugin.

  • Tool consumers install the compatible ESLint/Stylelint peer shown in package.json; applications do not need them.

  • Metadata and tooling load only through their own entrypoints and can run in Node without a DOM or CSS loader.

  • The package ships compiled ESM and declarations; consumers do not compile Density's TypeScript source.

  • Only the explicit public exports are supported, not arbitrary source or distribution paths.

  • React and ReactDOM are compatible optional peers and use the consuming application's instance.

  • Base UI, Motion, React Aria Components, TanStack Table, and D3 remain external runtime dependencies.

  • Core-only installation can therefore download React-related dependencies even though importing or bundling core does not use them.

  • Build tools stay development-only.

  • D3 declarations belong in consumer dependencies only if the public declaration graph requires them; isolated consumer checks currently pass without separately installing them.

Agent guidance and updates

  • The single bundled skill is node_modules/density-ui/skills/SKILL.md; its topic resources cover installation, React, core styling, themes, UI review, migration, and updates.

  • Packaging makes it readable but does not register it with an agent automatically.

  • Each delivery uses a new package version and filename.

  • Copy the new archive into vendor/, update the dependency and lockfile, and verify the production build.

  • Remove an unused old archive from the current tree.

  • Roll back the archive, manifest, and lockfile together through Git, then run pnpm install --frozen-lockfile.

  • CI needs only the committed files and ordinary third-party registry access.

  • The package is ESM only.

  • Verified integrations include framework-neutral core, TypeScript React 18.2 and 19.3 with Vite 7, and this repository's Astro documentation.

  • Vite 2.9 cannot resolve private imports in the tested current Base UI dependency graph.

  • Next.js App Router, RSC, CommonJS, and universal SSR are not verified.

  • Consult the installed peer ranges and versioned release report before claiming support for another environment.

Migrating older checkouts

  • Replace density-ui/all.css with density-ui/core.css followed by density-ui/themes.css.

  • Add the required --dn-color-item fill to custom themes.

  • Choose a neutral color that distinguishes contained items from the base app background and supports the theme text at 4.5:1 contrast.

  • Replace a theme family ID plus data-dn-color-mode with one concrete ID, such as density-modern-light or density-modern-dark.

  • Redmond 95 keeps density-redmond-95.

  • Match standalone imports to the new IDs and load both palettes before runtime switching.

  • Replace metadata colorModes with singular colorMode; remove Core mode APIs and validator mode/CLI --mode usage.

  • Application preference storage and System selection remain application-owned.

  • Replace Toolbar with View.

  • Use a horizontal flex layout for edge groups or a three-track grid for centered controls.

  • Keep accessibility roles and labels on the View.

  • Remove --dn-color-primary, --dn-color-primary-hover, and --dn-color-primary-active declarations from custom themes.

  • Use the matching normal, hover, or active primary clickable background when custom CSS needs to match a primary control.

  • Supply red, yellow, green, blue, and purple hue tokens in each custom theme appearance.

  • Remove palette-specific foreground, background, border, and clickable declarations, and categorical chart slot declarations.

  • Shared styles derive those values from the five hues.

  • Keep a semantic hue declaration when the theme needs an explicit override.

  • Replace standalone MacTrafficLights with Window’s osControls="mac"; choose gray lights with trafficLightsColor="gray".

  • Replace Window’s dismissable/onDismiss with osControls and onClose.

  • Window owns OS controls, accepts header content, and applies padding only around its body.

  • Replace boolean padding with "none", "sm", "md", or "lg". Padding is local to each component: View defaults to "none", and padded components default to "md". Parent padding does not change descendant components.

  • Replace Table/DataTable cellPadding, Tree rowPadding, and Accordion headerPadding/panelPadding with one padding prop. Item and cell overrides use the same name and scale. Table padding controls cells and pagination; an outer inset is added only with a border.

  • Replace Separator padding with gap; it continues to control margins around the hairline.

  • Replace Table's getRowProps with onRowClick for row activation or onRowHover for pointer entry and exit.

  • Place other attributes and handlers on content inside a cell.

  • DataTable supports the same row callbacks.

  • Remove color from Close calls.

  • Choose the dismiss action's presentation with appearance and emphasis.

  • Replace Pagination's showNumbers with paginationStyle: use "numberList" for numbered buttons, "textLabel" for the default page label, or "dots" for a window of up to ten page dots.

  • The old prop has been removed.

  • Replace Pagination's showFirstLast with arrowStyle: use "prevNext" for the default previous and next buttons, "prevNextFirstLast" to include first and last buttons, or "none" to hide arrows.

  • The old prop has been removed.

  • Replace composed Toggle children in ToggleGroup with items containing a value and label.

  • Use an optional accessible label for icon-only items and group emphasis for shared button styling.

  • Selection values remain arrays.

  • Use title and optional subtitle for List, selection-control, menu, Command, and Combobox items.

  • Rename Timeline item detail to subtitle, and Alert and Checkbox text children to title.

  • Field and group labels remain separate.

  • Card custom content remains mutually exclusive with built-in title and subtitle content.

  • Use textOrientation to arrange a component’s title pairs vertically by default or horizontally on a shared baseline.

  • Collection orientation and trigger content remain separate.

  • Replace NumberAnimation with Stat using its value, animate, and animationKey props.

  • Replace TextAnimation with Text, passing its former text as children and keeping animate and animationKey.

  • The standalone components and prop types have been removed.

  • Animation remains off by default and replays on mount or key changes; content updates alone render immediately.

  • Replace Label with Text and rename its associated types to TextProps, TextEmphasis, and TextHoverVisibility.

  • Text keeps the same rendering and props; the old component exports have been removed.

  • Replace the side-effect density-css import with density-ui/core.css followed by density-ui/themes.css; React applications also import density-ui/react.css explicitly afterward.

  • Components and helpers previously imported from density-base-ui use density-ui/react.

  • Metadata previously exported there or through its component API subpath uses density-ui/react/component-api separately.

  • Replace density-css/contract with density-ui/core.

  • Theme metadata and public variable registries use density-ui/theme; validation uses density-ui/theme/validate.

  • The old themes, variables, and theme-check JavaScript subpaths are removed.

  • Standalone theme CSS keeps its documented subpaths.

  • density-ui/core.css no longer loads themes.

  • Import density-ui/themes.css afterward for all built-in themes, or import a chosen standalone theme.

  • The former core ESLint, React ESLint, and CSS Stylelint plugin imports become density-ui/eslint/core, density-ui/eslint/react, and density-ui/stylelint respectively.

  • Use one archive dependency and the bundled consumer skill; legacy workspace aliases and shim packages are not retained.

Packages and modules

Repository development

  • Use Node.js 24.x and pnpm 9.15.9 for development; the package requires Node.js 22 or newer.
  • The repository root owns the one distributable manifest and version.
  • Library implementation lives under src/core/, src/theme/, and src/react/; those modules do not have separate package manifests.
  • Core owns component mechanics, layout, internal aliases, and token-usage lint tooling.
  • Theme owns appearance definitions, public metadata, and non-rendering validation.
  • React owns components, charts, private helpers, component API metadata, and React lint tooling.
  • Keep helpers and tooling beside their owning module; source ownership does not make every file public.
  • Public entrypoints select supported exports, and library modules use relative internal imports so a clean build never depends on a preexisting distribution.
  • Private projects are the website, examples, component gallery at previews/components/, Core catalog at previews/core/, theme preview at previews/theme/, and evaluations.
  • The internal development dashboards live in previews/, including the example browser at previews/examples/.
  • Reusable full app examples stay in examples/.
  • previews/ groups four independent app packages: components, Core, themes, and examples.
  • Each keeps its own development server, commands, and tests; the grouping folder is not a package.
  • The component, Core, examples, and theme previews put the preview name and app-specific controls on the left of a View header.
  • One concrete Theme picker and Debug where available sit on the right.
  • The picker groups Light then Dark and keeps family order within each group.
  • The preview shells follow the OS through an application-owned Modern palette mapping; specimen choices remain concrete IDs.
  • The preview shells use Density Modern and follow the OS color preference.
  • The toolbar selectors change the component specimens, Core catalog, selected example, or theme specimen window in their respective apps.
  • Drag the rail between the sidebar and preview in Component Preview, Core CSS Preview, or Theme Preview, or focus it and use the arrow keys.
  • The panes inside the theme specimen window meet at decorative rails and keep padding inside each pane.
  • The bundled consumer skill in skills/ guides installation, component use, styling, themes, UI review, and upgrades in downstream projects.
  • For the checkout-only maintainer QA skill and local verification commands, see DEVELOPERS.md in the repository.
pnpm install
pnpm dev
pnpm build:package
pnpm build:apps
pnpm --dir previews/examples dev
pnpm --dir previews/components dev
pnpm --dir previews/core dev
pnpm --dir previews/theme dev
pnpm --dir www dev
pnpm validate
pnpm pack:local
pnpm test:package
  • Authored Node/ESM scripts and configuration use .mjs; generated library ESM uses .js under type: module.

  • UI and application source use TypeScript.

  • Repository tests cover components and interactions, Core styling and lint rules, theme contracts, and development tooling.

  • Vitest runs through pnpm test; pnpm check verifies repository contracts separately.

  • Package acceptance checks install the actual archive into clean consumer projects and exercise representative behavior in Chromium.

  • Maintainers also use the local previews for targeted browser and accessibility reviews.

  • The AI evals measure how well agents build downstream interfaces from Density's public tools and documentation.

  • Maintainers run them on demand.

  • GitHub Actions validates pull requests to main and pushes to main, including package installation checks.

  • The intended branch policy requires the CI check to pass before merging.

  • Run pnpm dev from the root to build the package once and start all five supporting apps.

  • It prints URLs after they are ready: components at http://localhost:5173, examples at http://localhost:5174, themes at http://localhost:5175, Core at http://localhost:5176, and website at http://localhost:7210.

  • Ports are fixed; an occupied port fails instead of selecting another one.

  • Browser tabs open manually.

  • Shared library or build-input edits trigger one serialized package rebuild.

  • The launcher stops its preview servers before cleaning the distribution, then restarts them after a successful build.

  • Failed builds wait for the next edit; refresh open tabs if they do not reconnect.

  • App-only edits use their usual hot reload.

  • Ctrl-C stops the launcher and its child processes.

  • Apps consume compiled exports.

  • Standalone dev/build wrappers build the library first; restart standalone dev commands after library changes.

  • The internal dev:app commands skip that build for coordinated startup. build:apps builds supporting projects in order.

  • Avoid running another library build while the root launcher is active.

  • Source aliases must not be the reason an application passes verification.

Package builds and release verification

  • build:package cleans the generated distribution, checks metadata freshness, builds ESM with Vite 7, emits declarations with TypeScript, prepares separate stylesheets and tooling assets, and checks exports and preview types.
  • Component-local source CSS is extracted into the React stylesheet; compiled JavaScript must not load private CSS files.
  • Preserve core CSS order and zero-specificity selectors, custom properties, and overlay styles when changing extraction.
  • Keep framework boundaries intact: core stays React-free at runtime, browser entrypoints avoid Node-only imports, and ordinary component imports exclude metadata and lint initialization.
  • CSS is side-effectful; preserve JavaScript tree shaking when adding initialization.
  • Allowlist compiled output, the consumer README and skill, and required third-party notices.
  • Exclude supporting projects, source, tests, fixtures, internal docs, maintainer scripts, caches, machine paths, and source maps.
  • Density remains unlicensed and ships the upstream copyright notices and MIT terms for the included normalize CSS and adapted editor palettes in Third-party notices.
  • Include the applicable notices when distributing the theme CSS separately.
  • pack:local performs one canonical build and inspects the actual versioned archive.
  • It refuses to overwrite an existing filename.
  • Keep the root package private; local packing requires no registry publication or install-time build.
  • Archives and adjacent release/verification records live under ignored artifacts/packages/.
  • Each delivery records its version, source commit and working-tree state, checksum, validation results, dependency graph, and representative JS/CSS sizes.
  • The archive bytes, rather than the build folder alone, are the delivered contract.
  • Before delivering a new version, run pnpm validate, pnpm build:apps, and pnpm pack:local, then install Chromium with pnpm exec playwright install chromium and run pnpm test:package.
  • An existing immutable archive can be retested without repacking; bump the version before creating a replacement snapshot.
  • Consumer tests use the repository's pinned pnpm version and install the exact archive outside the workspace with normal dependency downloads, no borrowed dependencies or source aliases.
  • They cover core without a direct React dependency, advertised React versions, strict Bundler/NodeNext declarations, Node helpers/tooling, production builds, and frozen installs with update/rollback.
  • Browser checks cover button/input state, dialog focus and dismissal, measured charts, Density Modern and Solarized control backgrounds in light and dark modes, nested scopes, portals, and existing global styles.
  • Rendered-module checks keep React out of core and chart, animation, and metadata code out of a small component import.
  • Do not add consumer D3 types or relax size expectations to conceal a broken declaration or build boundary.
  • Recheck the real consumer's global CSS, overlays, controlled interactions, and production build when integrating a release.
  • After package checks pass on a push to main, CI uploads the archive and its SHA-256 checksum as the density-alpha workflow artifact for 30 days.

Verification and size baselines

  • Release verification includes repository tests, supporting production builds, and isolated Core and React 18.2/19.3 consumers.
  • Detailed results and the exact checksum belong in the adjacent release records.
  • Size comparison points for 0.1.2: 108,417-byte archive; 207,341-byte core CSS; 75,228-byte React CSS; 137-byte representative core JS; and Button bundles including React/Base UI of 91,945 bytes on React 18.2 and 70,100 bytes on React 19.3.
  • These are comparison points, not budgets; investigate unexplained growth before setting one.

TODO

Later

Packaging and delivery:

  • Decide registry name availability, accounts, publication, and any separate license change before offering a registry release.
  • Consider reproducible archives, CDN bundles, strict offline installation, and avoiding unused React dependency downloads without weakening the single-package contract.
  • Consider per-component installs or selective component CSS and an optional reset only as explicit API changes.

Frameworks and tooling:

  • Expose reusable custom-style lint rules and a preset through the public Density tooling so examples and consumer apps share the same checks and documented exceptions.
  • Add Next.js App Router/RSC or other framework adapters only when a consumer needs them, with deliberate client boundaries, directive preservation, CSS rules, and framework-specific tests.
  • CommonJS and broader SSR support also need their own verification.
  • Consider new lint presets and automatic initialization or extraction CLIs only as separately implemented and documented features; no such commands are available today.
  • Keep unrelated source refactors and broad lint/test tooling redesigns separate from package delivery; pursue them when there is a concrete maintainability need.

About

Design system for data-dense apps

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages