Skip to main content

Contributing

How to add to the system so the compiler picks it up and consumers can use it. After any change, run the gates CI runs (node scripts/check-tokens.js, check-classes.js, check-card-coverage.js, check-registry.js, check-bundle-exports.js, check-dts.js; the full list is in .github/workflows/ds-validate.yml) and fix what they report.

How the compiler sees the project​

  • Global CSS is styles.css (an @import manifest). Tokens and @font-face are read from its closure.
  • A component = a Name.d.ts (PascalCase) plus a sibling Name.jsx in the same folder. It compiles into _ds_bundle.js and is exposed at window.PrismDesignSystem_39d121.Name.
  • A specimen / doc card = an .html whose first line is <!-- @dsCard group="…" viewport="WxH" name="…" subtitle="…" -->. It renders in the visual guide, the docs site and Storybook, grouped by group.
  • Never hand-edit _ds_bundle.js, _ds_manifest.json or _adherence.oxlintrc.json. After a .jsx change, rebuild the bundle with node scripts/build-bundle.mjs.

Add a component​

  1. Create components/<group>/<Name>.jsx. Plain React. Styling = tokens-only, applied via a prism-* className.
  2. Add its CSS to components/<group>/<group>.css and ensure that file is @imported in components/components.css.
  3. Write components/<group>/<Name>.d.ts — exact prop types (this is the contract).
  4. Write components/<group>/<Name>.prompt.md — what it's for, when to use it, when not to, and a code example.
  5. Add or update the group's .card.html specimen (load ../../_ds_bundle.js, read from the namespace).
  6. Add the component to the index in docs/COMPONENTS.md.
  7. Rebuild the bundle (node scripts/build-bundle.mjs) and regenerate the registry, docs and Storybook (./update-ds.sh --regen, or npm run gen in prism-docs/).
  8. Run the gates → fix → repeat until clean.

Naming: PascalCase exports; prism-<component> / prism-<component>-<part> classes. Only capitalised exports reach the window namespace.

Add a token​

  1. Put it in the right tokens/*.css file (colour → colors.css, etc.). Define both light and dark values if it's a semantic colour.
  2. Reference existing primitives (var(--brand-500)) rather than new raw values; introduce a new palette ramp only when no existing hue fits, and define it in OKLCH.
  3. If you rename a token, alias the old name for one minor cycle (see MATURITY).
  4. Document it (token card and/or README token index). Validate contrast for any text/border colour.

Add a pattern​

A pattern is a composition (a workflow, a form layout, a permission flow). Build it from existing components; if you find yourself writing one-off markup twice, promote it to a component first. Document the recipe in PATTERNS.md (or the relevant docs/ guide) with a @dsCard if it warrants a visual.

Add a product signature​

Signatures live in tokens/signatures.css and re-skin a subtree via data-signature="…".

  1. Add a canonical hue to the --domain-* set in colors.css.
  2. Add [data-signature="<name>"] { --sig: var(--domain-<name>); } — the shared [data-signature] block derives the rest and adapts to light/dark automatically.
  3. If the hue is light (e.g. amber), override --accent-on to a dark value so on-accent text passes contrast.
  4. Note the recommended data-density in a comment and add the signature to the signatures card.

Add a template​

Templates are starting folders consumers copy. Create templates/<slug>/<Slug>.dc.html with <!-- @template name="…" description="…" --> as the first line of the body and <helmet><script src="./ds-base.js"></script></helmet>. Keep every file the template needs inside templates/<slug>/.

Demo data & assets​

  • Real photos in kits are reference-only (Pexels), declared in assets/demo/ and excluded from the package. Never depend on them in a shipped component.
  • Prefer CSS gradient/placeholder fallbacks so a component looks intentional even if an image 404s.

Keep the docs true​

A change is not finished until the pages that describe it are right. Update the hand-written docs in the same change as the code: the site pages under prism-docs/website/docs/ (all but the generated components/ and about/changelog.md), docs/*.md, readme.md, the package READMEs and the component *.prompt.md.

  • If you rename or remove something, add the old name to retired in scripts/docs-facts.config.json; the gate then lists every page that still mentions it.
  • Run node scripts/check-docs-facts.js. It fails on a token name, theme value, component count, package version or retired term that no longer matches the code.
  • Run cd prism-docs && npm run gen && npm run docs:build. The build fails on a broken link.

Review expectations​

  • Passes all applicable QA gates.
  • Tokens-only styling; correct maturity status; docs updated in the same change, and check-docs-facts passes.
  • The ds-validate gates pass.
  • Semver-appropriate (see MATURITY); breaking changes carry a migration note.