Interface Lab
Back to knowledge
Frontend Implementation

Copy-in Component Governance

Copy-in components such as shadcn/ui become local assets once added, so they need token mapping, a state matrix, upgrade policy, and license records.

Design Principle

The advantage of copied source components is control and adaptability. The cost is that the project owns consistency, upgrades, license notices, and design-system adaptation.

Large Theory

Copying source code is not the same as installing a black-box library. Once a component enters the repository, naming, tokens, variants, states, tests, and documentation should follow local component governance.

Small Points

  1. Every copy-in component maps to local color, radius, shadow, spacing, and typography tokens.
  2. Variants should express product semantics such as primary, secondary, danger, and ghost, rather than copying every visual option from the reference project.
  3. Check at least default, hover, focus-visible, disabled, loading, error, empty, selected, and reduced-motion states.
  4. Upgrades should never overwrite local files blindly; compare behavior, API, and styling diffs.

Design Judgment

If a component is copied and then className-patched everywhere, it will quietly fork. If it is compressed into a local API, state matrix, and token contract, it becomes maintainable infrastructure.

Implementation Notes

When adding a copy-in component, record source URL, version or commit, license, primitive dependency, token mapping, accessibility checks, page usage examples, and disallowed changes. Complex components should have a Story, preview, or local test page.

Counterexamples/Risks

Copying a dashboard block while keeping external color variables, mixing Pro or paid blocks into an open library, changing button radius per page, and upgrading shadcn over local accessibility fixes.

Case Study

The shadcn/ui GitHub repository describes the project as open source, open code, and a code distribution platform, under the MIT license. The reusable lesson is that shadcn/ui acts more like source distribution than a conventional UI package; after intake it should be governed as local code.

Source Links

shadcn/ui: https://ui.shadcn.com/ shadcn/ui GitHub: https://github.com/shadcn-ui/ui

Agent Directive

Before copying a component, record source and license; after copying, immediately map it to local tokens, API, and state matrix instead of scattering reference styles across pages.