- React Chromatic Storybook: https://69ae3d6f019c2b8f497fdd28-zwrtooohxn.chromatic.com/
- Angular Chromatic Storybook: https://69ae3de6fef62640081354ec-fbslbprsoe.chromatic.com/
- React package on npm: https://www.npmjs.com/package/@accretion-ui/react
- Angular package on npm: https://www.npmjs.com/package/@accretion-ui/angular
This repository is a production-oriented starting point for a shared component library that is authored once and shipped as native packages for React and Angular. It currently ships one component, Accordion, because the goal is to validate the architecture, accessibility quality, SSR behavior, testing workflow, and documentation standard before scaling the library wider.
This setup reduces the usual tradeoff between consistency and framework fit. Design decisions, semantic tokens, accessibility expectations, and base interaction rules live in one shared source layer, while React and Angular consumers still receive framework-native packages instead of web component wrappers. That makes evaluation faster for both product and design stakeholders and keeps adoption simpler for application teams.
Within a single session you can validate:
- the visual and interaction quality of the Accordion in both frameworks
- server-rendered markup and clean hydration in real SSR apps
- Storybook documentation quality for both targets
- Chromatic publishing for both Storybooks
- automated behavior coverage across unit, browser, and smoke checks
Accordion gives teams a structured way to reveal supporting detail without fragmenting a page. It works well for FAQs, rollout plans, pricing clarifications, policies, onboarding flows, and implementation handoff content where people need progressive disclosure without losing context.
Use these checks first:
- Run both Storybooks and confirm the docs pages explain purpose, API, accessibility, and common usage patterns.
- Run both SSR smoke apps and confirm the Accordion renders before hydration, then remains interactive after hydration.
- Run the test and smoke commands to confirm keyboard support, controlled behavior, disabled handling, and Storybook page availability.
Published Storybooks:
- React Chromatic Storybook: https://69ae3d6f019c2b8f497fdd28-zwrtooohxn.chromatic.com/
- Angular Chromatic Storybook: https://69ae3de6fef62640081354ec-fbslbprsoe.chromatic.com/
The repo uses a layered approach:
packages/corecontains shared Accordion logic, types, token-driven CSS generation, and the Mitosis-authored low-level view parts.packages/reactpublishes the React package. It uses generated React view parts from Mitosis plus a thin React-native compound API for state, context, ids, and keyboard behavior.packages/angularpublishes the Angular package. It uses native standalone host-bound primitives attached directly to real DOM elements so Angular consumers keep a one-element-per-part API without wrapper nodes.chromatic/reactandchromatic/angularhold the Storybook surfaces used locally and in Chromatic.smoke-apps/react-nextandsmoke-apps/angular-ssrvalidate SSR and hydration in real framework runtimes.testingcontains Vitest and Playwright coverage across logic, React behavior, SSR smoke apps, and Storybook availability.
packages/
core/
react/
angular/
chromatic/
react/
angular/
smoke-apps/
react-next/
angular-ssr/
testing/
scripts/
tokens/
Requirements:
- Node.js 20.19+ is recommended
- npm 11+
Install dependencies:
npm installGenerate token-driven styles and Mitosis outputs:
npm run generateMitosis is the shared authoring layer for the low-level Accordion view parts in packages/core/src/components/accordion. Those files generate native React and Angular view output through scripts/generate-mitosis.mjs.
The public package layers are intentionally thinner than a full wrapper library:
- React uses the generated Mitosis view parts directly and adds framework-native state/context handling.
- Angular keeps the generated view output in-repo for reference, but ships native standalone directives as the public API. This is an intentional tradeoff because the current Mitosis Angular target is not a reliable fit for compound, context-driven primitives that must preserve one host element per part.
Token-derived styling is generated by:
npm run generate:stylesMitosis output generation runs:
npm run generate:componentsThe style generator reads:
tokens/primitives.jsontokens/semantic/accordion.json
Build both publishable packages:
npm run buildBuild React only:
npm run build:reactBuild Angular only:
npm run build:angularBuild output locations:
- React package artifacts:
packages/react/dist - Angular package artifacts:
dist/packages/angular
npm run storybook:reactDefault URL: http://127.0.0.1:6006 Published Chromatic URL: https://69ae3d6f019c2b8f497fdd28-zwrtooohxn.chromatic.com/
npm run storybook:angularDefault URL: http://127.0.0.1:6007 Published Chromatic URL: https://69ae3de6fef62640081354ec-fbslbprsoe.chromatic.com/
The script reads CHROMATIC_PROJECT_TOKEN_REACT_MITOSIS from the environment.
npm run chromatic:reactAfter publishing, update the React Storybook links in:
README.mdpackages/react/README.md
The script reads CHROMATIC_PROJECT_TOKEN_ANGULAR_MITOSIS from the environment.
npm run chromatic:angularAfter publishing, update the Angular Storybook links in:
README.mdpackages/angular/README.md
Run unit and integration coverage:
npm run test:unitRun the Playwright suite:
npm run test:playwrightRun everything:
npm testRun framework-specific browser smoke checks against production-style builds:
npm run smoke:react
npm run smoke:angularRun both:
npm run smokeSSR validation fetches the rendered HTML from the built smoke apps and confirms the Accordion markup, ids, and stylesheet references are present before browser hydration.
npm run validate:ssr:react
npm run validate:ssr:angularRun both:
npm run validate:ssrFor local interactive SSR development:
npm run dev:react-ssr
npm run dev:angular-ssrThis repo is set up as a publishable monorepo, but publishing is intentionally explicit.
- Update package versions in
packages/react/package.jsonandpackages/angular/package.json. - Run
npm run build. - Run
npm test,npm run smoke, andnpm run validate:ssr. - Run
npm run chromatic:reactandnpm run chromatic:angular. - Update Storybook links in
README.md,packages/react/README.md, andpackages/angular/README.mdto match the newest Chromatic builds. - Dry-run the publish artifacts with
npm pack --dry-runinpackages/reactanddist/packages/angular. - Publish
packages/reactas@accretion-ui/react. - Publish
dist/packages/angularas@accretion-ui/angular.
React is publishable directly from its package folder because the build writes into packages/react/dist. Angular is published from dist/packages/angular because the package is assembled after Angular compilation.
- The Angular public package uses native directives instead of directly shipping the generated Mitosis Angular output. This keeps the compound API and one-element-per-part contract stable.
- Closed panel containers stay mounted in both targets so
aria-controlstargets remain stable, but panel content is unmounted by default unlesskeepMountedorhiddenUntilFoundis enabled. - React exposes
hiddenUntilFound, but React DOM normalizeshiddenvalues during SSR. The package corrects the attribute after hydration so browser find-in-page can still work, but the initial HTML is still serialized as standardhidden. - The current repo is intentionally scoped to Accordion only. The structure is designed for expansion, but no placeholder components were added.