Guidance for AI coding agents working in this repository.
Before working on components, read .agents/skills/contributing/SKILL.md. It routes to the
references for new components, tests, a11y, stories, refactoring and PR review. Harnesses with skill
support load it from .agents/skills/ (Claude Code through the .claude/skills/contributing symlink).
TEDI Design System Angular component library (@tedi-design-system/angular). Angular 20 standalone component library published via ng-packagr, with Storybook for documentation.
Supported Angular versions: 20, 21 and 22 — the published peer range is ^20.0.0 || ^21.0.0 || ^22.0.0 (declared in both package.json and src/package.json). The repo itself develops against Angular 20, which is also the floor consumers may be on, so do not rely on APIs introduced after Angular 20.
npm start # Start Storybook dev server (port 6006)
npm test # Run all tests (Jest)
npm run test:watch # Run tests in watch mode
npx jest path/to/file --coverage=false # Run a single test file (npm test passes on a typo'd path)
npm run lint # Stylelint (SCSS) + ESLint (TS/HTML) with --fix
npm run build # Build library to dist/src/tedi/components/— All UI components, organized by category (form, buttons, overlay, etc.)src/tedi/directives/— Attribute/structural directivessrc/tedi/services/— Services (translation, theme, breakpoint, toast)src/tedi/utils/— Utility functions (date, cookies, elements)src/tedi/tokens/— Injection tokens (theme, translation)src/tedi/providers/— Angular providerssrc/community/— Community-contributed components (separate entry point, NOT a reference for TEDI patterns)
The library lives under
src/(src/tedi,src/community), withsrc/package.json+src/ng-package.jsonas the ng-packagr primary entry point. The rootpackage.jsonis the workspace/tooling manifest. This mirrors the React repo'ssrc/layout — see issue #166.
Each component folder contains:
component-name.component.ts # Component class
component-name.component.html # Template
component-name.component.scss # Styles
component-name.component.spec.ts # Tests
component-name.stories.ts # Storybook stories
index.ts # Barrel export
All components are:
- Standalone (
standalone: true) - OnPush change detection
- ViewEncapsulation.None (styles not encapsulated)
- Using Angular signals (
input(),model(),signal(),computed()) - Selector prefix:
tedi-(e.g.,tedi-button,tedi-date-picker)
Form controls implement ControlValueAccessor with NG_VALUE_ACCESSOR provider for reactive forms integration.
src/public-api.ts → src/tedi/index.ts → category index.ts → component index.ts
Path aliases:
@tedi-design-system/angular/tedi→./src/tedi/index.ts@tedi-design-system/angular/community→./src/community/index.ts
- BEM with
tedi-prefix:.tedi-component,.tedi-component__element,.tedi-component--modifier - Sub-components that are their own Angular components are separate BEM blocks with a shared prefix:
tedi-modal-header,tedi-modal-footer(nottedi-modal__header). Use__elements only for simple DOM nodes inside a single component's template (e.g.,tedi-modal-header__head). - Stylelint enforces the
tedi-prefix pattern on all class selectors - Design tokens come from
@tedi-design-system/core - Max nesting depth: 4
- Target CSS classes, not Angular element selectors — add classes to component hosts and style those. Only style element selectors directly for third-party components where you can't control the host (e.g.,
cdk-dialog-container).
- Jest with
jest-preset-angular, jsdom environment, 80% coverage threshold. Setup and patterns:.agents/skills/contributing/references/testing.md. - Stories at
src/tedi/**/*.stories.ts. Titles, argTypes and composition rules:.agents/skills/contributing/references/stories.md.
- Conventional commits enforced by commitlint
- Must reference an issue (e.g.,
feat(date-picker): add feature #258) - Subject minimum 10 characters
- Pre-commit hook runs lint-staged (stylelint + prettier)
- TEDI React (
../react/) — React implementation of the same design system. Useful as behavioral reference. - TEDI Core (
../core/) — Shared design tokens, SCSS variables, fonts, and icons.
Note: These sibling repositories are available in local development only. They are NOT present in CI/CD environments — do not rely on
../react/or../core/paths in build scripts, tests, or imports that run in CI.
main— production releasesrc— pre-releases (base branch for PRs)
- Use
@Input(),@Output(), or@ViewChild()decorators — useinput(),model(),output(),viewChild()signal APIs - Use
ViewEncapsulation.EmulatedorShadowDom— alwaysViewEncapsulation.None - Hardcode color values — always use design tokens from
@tedi-design-system/core - Use fallback values in CSS
var()functions — writevar(--token-name), notvar(--token-name, fallback) - Use Angular encapsulation for style scoping — use BEM naming with
tedi-prefix instead - Forget
multi: trueinNG_VALUE_ACCESSORproviders - Forget
forwardRef()when a component references itself in its own providers - Add event listeners without removing them in
ngOnDestroy— use arrow function properties for correct reference - Use regular methods for event handlers that need cleanup — use
handleX = (e: Event) => {}property syntax - Forget to provide
TediTranslationServicemock andTEDI_TRANSLATION_DEFAULT_TOKENin tests - Use
fakeAsync/tickwithout cleaning up inafterEach - Use
src/community/components as reference for coding patterns or style — they are community-contributed and not always reviewed - Forget to add
.parent__button:hover .tedi-icon { color: inherit; }(and similar for selected/active states) in components that contain icons and change text color on state — without this, the icon's color modifier class wins over the parent's color. Usecolor="inherit"for component-owned icons; for projected icons, the CSS override ensures the consumer's color applies in default state but inherits on hover/selected - Style Angular element selectors directly (e.g.,
tedi-modal-header { ... }) — add a CSS class to the host and style the class instead. Exception: third-party elements you can't add classes to (e.g.,cdk-dialog-container)
Read .agents/skills/contributing/references/best-practices.md for the full set of coding patterns and rules to enforce during review, and apply the Input API and Prose sections of .agents/skills/contributing/references/pr-review.md.
Key things to not flag:
ViewEncapsulation.None— intentional, not a security concern.- Missing CSS
var()fallback values — intentionally omitted. src/community/code not following TEDI patterns: community components have lighter standards.- CdkListbox private API access (
_setNextFocusToSelectedOption,_handleKeydown) in the select component — intentional workarounds, no public CDK alternative exists. parameters.status: { type: ["breakpointSupport"] }on a story — this is a valid, registered status badge (see.storybook/preview.tsxandbest-practices.md). Keep it on components with breakpoint-dependent behavior or inputs that accept breakpoint values. Do not suggest removing it.