ThinkingCap
ThinkingCap Research And Development UX Storybook Thinking Cap: Shared UI and Storybook Architecture

Thinking Cap: Shared UI and Storybook Architecture

Published 2026-11-09 Isobel Wallace
Research And Development

Thinking Cap: Shared UI and Storybook Architecture

Architecture reference | 24 October 2026

Decision and goal

Use one central tc-storybook application to review three experience shells (Admin, Guest, Learner) and a catalogue of Shared Stories. Reuse one authoritative production implementation of each genuinely shared UI component across independently deployed surface repositories. Storybook is a development, documentation and testing tool, not a production rendering service.

The implementation and packaging details must be confirmed by an audit of existing shared components and the lv-site-template distribution kit before migration.

1. Architecture

flowchart TB
  SB["tc-storybook<br/>Central catalogue and visual tests"]
  EX["Experience stories<br/>Admin | Guest | Learner shells"]
  SS["Shared Stories<br/>states, fixtures, contracts"]
  UI["Shared UI component package(s)<br/>production React components and theme tokens"]
  R1["tc-console"]
  R2["Admin Work Surfaces"]
  R3["lv-site-template"]
  R4["Learner Surfaces"]
  SB --> EX
  SB --> SS
  SS -. "renders and tests" .-> UI
  UI --> R1
  UI --> R2
  UI --> R3
  UI --> R4

Direction of dependencies: Surface applications import shared production components. Storybook imports those same components to render examples. Surface applications do not import Storybook or send production data to stories.

2. Storybook navigation

These are four navigation sections inside one Storybook, not four Storybook installations. Experience shell stories can compose shared production components.

3. What lives where

AssetAuthority
Storybook app, sidebar, documentation, cross-experience fixtures and visual testingtc-storybook
Canonical shared component stories and state specificationsCentral Shared Stories catalogue, with source ownership and validation defined during implementation
Reusable production components and their public TypeScript contractsShared UI package(s), location to be confirmed
Brand/theme tokensExisting authoritative shared theme system
Shell composition and application-specific UItc-console and lv-site-template
Surface workflows, API integration, permissions and local compositionIndividual Admin and Learner Surface repos

A shared story is an example of a component, not the component itself. Centralizing stories alone does not distribute executable production UI. A common component can be shared only if surfaces consume the same implementation or compatible published package.

4. Example: progress bar

A developer needs a progress bar in a Learner Path surface. The AI development rules require searching the approved component registry. If ProgressBar exists, the surface imports it from the approved production package and passes LMS data through props.

import { ProgressBar } from '@tc/ui'; // illustrative package name

<ProgressBar value={path.percentComplete} label="Learning path progress" />

Storybook separately renders the same component with representative fixtures (0%, 25%, 75%, 100%, error, loading, themes). The live application never sends data to Storybook. The story validates what the component should display for supplied inputs.

flowchart LR
  API["LMS/API data"] --> SUR["Learner Surface"]
  SUR --> UI["Shared ProgressBar"]
  FIX["Story fixtures"] --> STORY["Storybook story"]
  STORY --> UI

5. Example: transcript across four surfaces

Learner Transcript, Connections, Admin Users and Admin Activities may all need transcript UI. They should reuse a common transcript component or smaller transcript primitives (rows, completion status, credit summary) where contracts match. The surfaces retain responsibility for fetching records, permissions, actions, and context-specific composition. Admin-only capabilities can be explicit props or compositions, not duplicated implementations.

6. AI Development Bible rule

Before creating or modifying UX, search the approved Storybook/component registry.

  1. Exact match: Import the approved shared production component. Use documented props and variants. Do not duplicate it.
  2. Partial match: Propose a compatible extension, and update its component contract and stories together.
  3. No match: Propose a new shared component and canonical stories when reuse is likely; otherwise justify a local component.
  4. Exception: Record why a local implementation is needed (distinct behaviour, dependency, security, or performance constraints).
  5. Verification: Run TypeScript checks, unit tests, accessibility checks, relevant Storybook stories and visual regression tests.

Make the catalogue machine-readable: component ID, package/import path, owner, props, variants, story IDs, status, and consuming repositories. AI review helps enforce reuse, but deterministic CI checks must cover imports, contracts and tests. A visual lookalike detector is not guaranteed.

7. How updates reach consuming surfaces

flowchart TD
  A["Shared component or approved UX contract changes"]
  B["Update implementation + canonical stories"]
  C["CI: type, unit, accessibility and visual tests"]
  D["Publish versioned component package"]
  E["Identify consuming repositories"]
  F["Automated dependency update PRs"]
  G["Run affected surface and integration tests"]
  H{"Compatible and approved?"}
  I["Merge and deploy affected surfaces"]
  J["Fix migration or reject change"]
  A --> B --> C --> D --> E --> F --> G --> H
  H -- Yes --> I
  H -- No --> J
  J --> G

Use Renovate or Dependabot, or equivalent automation, to propose dependency updates. A dependency registry should be generated from actual package manifests and imports, not maintained only by hand. Do not auto-merge breaking changes without validation.

8. Branding and compatibility

Shared components consume existing design tokens and customer brand font stacks. They must not hardcode branded colours, fonts, radii or shadows. Storybook must test Admin, Guest and Learner contexts, light/dark configurations and accessibility. Story fixtures must not override customer branding to manufacture a passing appearance. Do not move production shell code into Storybook.

9. Migration from the current setup

Known baseline: lv-site-template already hosts a centralized Learner Storybook and distribution kit; the Credentials pilot has validated stories. Do not discard this work.

Audit before modifying:

  1. Inventory Storybook configuration, distribution-kit generated files, story source locations and CI across lv-site-template, tc-console and participating surfaces.
  2. Inventory existing shared UI packages, token ownership, package versions, import paths and cross-repository dependencies.
  3. Identify canonical shared components, duplicates and surface-specific variants. Start with User Identity, ProgressBar, Activity Thumbnail and Transcript.
  4. Decide how tc-storybook resolves components across repos: published versioned packages are preferred for reproducible builds; a controlled multi-repo workspace may support development.
  5. Migrate the central Storybook application without changing runtime imports or deployment behaviour. Preserve validated Learner stories.
  6. Add the three shell sections and Shared Stories catalogue, then enable visual/accessibility testing and dependency update automation.
  7. Retire redundant Storybook kit infrastructure only after parity, consumer tests and rollback procedures are verified.

Open decisions: package ownership and publishing; registry generation; shared story source location; consumer version policy; visual test baseline approvals; rollout sequencing. These are implementation decisions, not facts already verified about current repositories.

10. Acceptance criteria

Read this page as Markdown: https://console.thinkingcap.com/guest/Research-and-Development/UX/Storybook/Thinking_Cap_Storybook_Architecture_Guide.md
Same content, machine form. The whole corpus: /guest/all.md.