1---2name: design-system3description: Guidelines for using and contributing to the @code-dot-org/component-library design system and the DSCO-to-MUI migration. Use when working on React UI in apps/ or frontend/.4---56# Design System (`@code-dot-org/component-library`)78## Overview9- Our design system has two types of components:10 - **DSCO components**: our custom React components in `frontend/packages/component-library/` (TypeScript).11 - **MUI components**: from `@mui/material`, with custom style overrides in `frontend/packages/component-library/src/themes/.../styleOverrides/` to match our design system look and feel.12- Shared styles (colors, typography, mixins) live in `frontend/packages/component-library-styles/`.13- **Always prefer design system components** over custom or legacy alternatives (e.g. `apps/src/sharedComponents/`, `apps/src/legacySharedComponents/`). Only create custom UI components when no design system equivalent exists.1415## Which Component to Use16- **Use MUI** for: Typography, Button/LinkButton/GenericButton, Breadcrumbs, IconButton. These have been migrated — their DSCO equivalents are deprecated.17- **Use DSCO** for: everything else (Checkbox, Dialog, Dropdown, Tabs, TextField, Toggle, etc.). Browse `frontend/packages/component-library/src/` to discover available components.18- **Unsure?** Check `frontend/packages/component-library/MIGRATION_STATUS.md` for the full per-component status, or look for `@deprecated` / `DEPRECATED` in the component's JSDoc header.19- DSCO import: `import Checkbox from '@code-dot-org/component-library/checkbox';`20- MUI import: `import {Typography as MuiTypography} from '@mui/material';` — style overrides are applied automatically via the theme.21- For API reference: [DSCO Storybook](https://code-dot-org.github.io/code-dot-org/component-library-storybook) | [MUI docs](https://mui.com/material-ui/all-components/)2223## Typography24- Use MUI's `<Typography>` component. DSCO Typography is deprecated.25- Our MUI theme defines custom variants that map to our design system type scale. The theme is applied at the app level via `<ThemeProvider theme={CdoTheme}>` — you don't need to wrap components yourself.26- Font variables are in `@code-dot-org/component-library-styles/fontVariables.css`.2728## Styling29- Use **SCSS modules** (`.module.scss`) for all component styling. Never use inline styles or global styles.30- **Color priority**: always use semantic colors (`@code-dot-org/component-library-styles/colors.css`) first, then primitive colors (`primitiveColors.css`) second, then other colors only as last resort.31- Semantic colors are CSS variables (e.g., `var(--text-neutral-primary)`) that support light/dark theming via the `data-theme` attribute.32- **Never rely on stylesheet load order** for specificity. Always use CSS selector specificity rules.33- Override component styles via parent element selectors or component-specific class selectors in SCSS modules.3435## Contributing & Extending the Design System36- For building new DSCO components, see `frontend/packages/component-library/CONTRIBUTING.md` and `README.md`.37- **MUI style overrides** live in `frontend/packages/component-library/src/themes/`. When migrating a DSCO component to MUI, add or update the corresponding style override file here.38- `CdoTheme` **MUI theme**: `frontend/packages/component-library/src/themes/code.org/`. Defines custom typography variants, button sizes/colors, and CSS variables for light/dark theme support.39- **MUI type augmentation**: custom types (extra button sizes, colors, typography variants) are declared in `frontend/packages/component-library/types/mui.d.ts` and must be manually synced to `apps/src/types/mui.d.ts`.40- When making major changes to `frontend/packages/component-library/` or `frontend/packages/component-library-styles/`, update this skill file and any relevant component library docs (README, CONTRIBUTING, MIGRATION_STATUS) to keep them in sync.