Principle:21st dev Magic mcp Component Integration
| Knowledge Sources | |
|---|---|
| Domains | UI_Components, Integration |
| Last Updated | 2026-10-19 16:40 GMT |
Overview
An integration pattern that wires an installed or generated component into the host page and adapts its tokens/props to the project's design system, so it renders consistently with surrounding UI.
Description
Component integration is the act of placing an installed (or generated, or logo) component into the host page and aligning it with the project's existing conventions: Tailwind config, the `cn` class-merge helper, and the component folder layout. It addresses the limitation that a component copied from a marketplace is generic — it ships with its own tokens/props and default imports, which may clash with the host project's design system. Integration is the last step after retrieval/install (or generation): import the component, pass the right props, and adapt class names to the project's tokens so it looks native.
Usage
Use this principle after a component has been installed (registry add or direct file writes), generated, or retrieved as a logo. It is the "wire in and adapt" step shared by the install, generate, and logo workflows.
Theoretical Basis
The core operation is an adapt-then-mount:
# Abstract algorithm description (NOT real implementation)
component = import_from_installed_files() # or generated / logo JSX
props = map_to_project_tokens(component.defaults, project.design_tokens)
markup = render(component, props) # using project's cn helper + Tailwind config
page.mount(markup)
The adaptation layer is what makes a generic catalog component look native in a specific project.
Practical Guide
- Match the project's existing conventions: Tailwind config, `cn` helper, component folder layout.
- Import the component from where it was installed; do not duplicate it.
- Adapt class names and props to the project's design tokens (colors, spacing, radii).
- Verify responsive and dark-mode behavior against the host page.
- Free-tier install limit (2/day) applies to installs, not to wiring/adapting already-installed components.
Related Pages
Implemented By
Notes
- Terminal step of three workflows: Principle:21st_dev_Magic_mcp_Component_Installation, Principle:21st_dev_Magic_mcp_AI_UI_Generation, Principle:21st_dev_Magic_mcp_Brand_Logo_Retrieval.
- For generated UI, the code comes from Principle:21st_dev_Magic_mcp_Generation_Review; for logos, from Principle:21st_dev_Magic_mcp_Brand_Logo_Retrieval.