Guidance for coding agents working in this repository.
Element Plus is a Vue 3 UI component library written in TypeScript. This repo is a pnpm workspace monorepo.
packages/components: individual Element Plus components.- Component source usually lives in
src/. - Tests live in
__tests__/. - Style entry files live in
style/.
- Component source usually lives in
packages/theme-chalk: component SCSS and theme output.packages/hooks,packages/utils,packages/constants,packages/directives,packages/locale: shared runtime packages.packages/element-plus: package entry and bundle surface.docs: VitePress documentation site.play: local playground used for manual component testing.internal: build, metadata, lint, and workspace tooling.dist: generated output. Do not edit generated files by hand unless the task explicitly requires it.
- Install dependencies:
pnpm install - Start playground:
pnpm dev - Start docs site:
pnpm docs:dev - Run all tests:
pnpm test - Run a focused test file:
pnpm test packages/components/<component>/__tests__/<file>.test.tsx - Run lint:
pnpm lint - Fix lint issues:
pnpm lint:fix - Run type checks:
pnpm typecheck - Build package output:
pnpm build - Build theme only:
pnpm build:theme - Build docs:
pnpm docs:build - Format repo:
pnpm format
- Prefer existing component patterns over new abstractions. Look at nearby components before changing structure.
- Keep changes scoped to the requested behavior. Avoid unrelated refactors and formatting churn.
- For component changes, check whether related props, emitted events, exposed types, styles, tests, and docs need updates.
- Use the workspace packages and existing aliases such as
@element-plus/*instead of introducing new local paths casually. - Avoid adding dependencies unless the task clearly needs them and the existing toolchain cannot cover it.
- Use
play/src/App.vuefor quick manual repros, but keep playground-only edits out of final changes unless requested.
- Tests use Vitest and Vue Test Utils.
- Put component tests under
packages/components/<component>/__tests__/. - Prefer focused regression tests for bug fixes.
- Update snapshots only when the rendered output change is intentional.
- When touching shared utilities, hooks, or cross-component behavior, run the relevant focused tests plus a broader check when practical.
- Public API changes should include matching docs updates under
docs. - When documenting a new API, always add a version tag using the existing docs style, unless the user explicitly asks otherwise. Fetch the latest Element Plus version from the newest GitHub Release tag, strip any leading
v, then calculate the version tag from that version: increment the patch version for non-breaking changes; increment the minor version and reset the patch version to zero for breaking changes. For example, from2.10.0, use2.10.1for a non-breaking change and2.11.0for a breaking change. - Keep prop, event, slot, and expose typings in sync with implementation behavior.
- Locale-facing text should go through the existing locale package patterns.
- Do not commit, push, or open pull requests unless explicitly asked.
- Do not revert user changes or unrelated work in the tree.
- If a commit is requested, use the existing conventional commit flow;
pnpm czis available. - Before committing, ensure formatting, lint, typecheck, and test all pass.
- Before finishing, report the commands you ran and any checks you could not run.