packages/ui/docs/migration-plan.md
This document is development-only planning material for the packages/ui workspace.
It is not part of the runtime package surface and should not be treated as package API documentation.
This document outlines the detailed plan for migrating Cherry Studio from antd + styled-components to shadcn/ui + Tailwind CSS. We will adopt a progressive migration strategy to ensure system stability and development efficiency, while gradually implementing UI refactoring in collaboration with UI designers.
--cs-* values// Import components from @cherrystudio/ui
import { Spinner, DividerWithText, InfoTooltip } from '@cherrystudio/ui'
// Use in components
function MyComponent() {
return (
<div>
<Spinner size={24} />
<DividerWithText text="Divider Text" />
<InfoTooltip content="Tooltip message" />
</div>
)
}
@packages/ui/
├── src/
│ ├── components/ # Main components directory
│ │ ├── primitives/ # Basic/primitive components (Avatar, ErrorBoundary, Selector, etc.)
│ │ │ └── shadcn-io/ # shadcn/ui components (dropzone, etc.)
│ │ ├── icons/ # Icon components (Icon, FileIcons, etc.)
│ │ └── composites/ # Composite components (CodeEditor, ListItem, etc.)
│ ├── hooks/ # Custom React Hooks
│ ├── styles/ # Global styles and CSS variables
│ ├── types/ # TypeScript type definitions
│ ├── utils/ # Utility functions
│ └── index.ts # Main export file
When submitting PRs, please place components in the correct directory based on their function:
All file and directory names below are written in kebab-case per
packages/ui/'s naming convention (see README "Naming Conventions"). The PascalCase identifiers in parentheses refer to the exported component names inside those files.
avatar/ (Avatar): Avatar componentserror-boundary/ (ErrorBoundary): Error boundary componentsselector/ (Selector): Selection componentsshadcn-io/: Direct shadcn/ui components or adaptationsicon/ (Icon): Icon factory and basic iconsfile-icons/ (FileIcons): File-specific iconsSvgSpinners180Ring, ToolsCallingIcon, etc.)code-editor/ (CodeEditor): Code editing componentslist-item/ (ListItem): List item componentsthinking-effect/ (ThinkingEffect): Animation componentsdraggable-list/, editable-number/, etc.)| Phase | Status | Main Tasks | Description |
|---|---|---|---|
| Phase 1 | ✅ Completed | Design System Integration | • Converted design values from todocss.css to the token sources |
| • Added a unified unprefixed public contract for official Shadcn and Cherry Studio product semantics | |||
| • Added a controlled runtime-input boundary for host theme customization | |||
| • Generated explicit Tailwind mappings for public semantic contracts only | |||
| • Added token-level spacing values and an extended radius system; semantic spacing utilities remain intentionally disabled | |||
| • Migrated consumers and removed the temporary renderer semantic bridge | |||
| Phase 2 | ⏳ To Start | Component Migration and Optimization | • Filter components for migration based on extraction criteria |
| • Remove antd dependencies, replace with shadcn/ui | |||
| • Remove HeroUI dependencies, replace with shadcn/ui | |||
| • Remove styled-components, replace with Tailwind CSS + design system variables | |||
| • Optimize component APIs and type definitions | |||
| Phase 3 | ⏳ To Start | UI Refactoring and Optimization | • Gradually implement UI refactoring with UI designers |
| • Ensure visual consistency and user experience | |||
| • Performance optimization and code quality improvement |
Do NOT migrate components with these dependencies (can be migrated after decoupling):
Can migrate but need decoupling later:
Submission Guidelines:
--cs-* spelling remains as an internal provider--cs-theme-* values are controlled inputs, not component-facing semantics or Tailwind colors--cs-* variables are internal providers; --cs-theme-* is the controlled host-written input subset--color-* is generated Tailwind adapter output only50 through 950 step convention5xs through 8xl (16 levels); they are not a public Tailwind utility contract--radius input with derived sm through 4xl and full; smaller and round aliases remain for compatibility