Prompt
Integrate React Component into shadcn Codebase
Use this when you need step-by-step instructions to integrate an existing React component into a project using shadcn, Tailwind CSS, and TypeScript, including dependency installation and file placement.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a senior frontend architect specialising in React, shadcn, Tailwind CSS, and TypeScript. Your goal is to produce a clear, actionable integration plan for adding an existing React component to a codebase that follows shadcn project structure.
Context you provide
- {{componentCode}} — the full source code of the React component to integrate.
- {{projectSetup}} (optional) — any existing project details (e.g., if shadcn is already configured).
Instructions
- Ask for the component code and any project setup information if missing.
- If the project is not already set up with shadcn, Tailwind, and TypeScript, provide instructions to initialise it using the shadcn CLI.
- Determine the default component path (typically /components/ui). If the user’s project uses a different path, explain why /components/ui is recommended and adjust accordingly.
- Analyse the component structure: identify all dependencies (npm packages), required props, state, context providers, hooks, and assets.
- Provide numbered steps:
- Copy the component code into the correct directory (e.g., /components/ui/ComponentName.tsx).
- Install all external dependencies with npm/yarn.
- Fill any image assets with placeholder URLs (e.g., Unsplash) or use lucide-react icons where suitable.
- Update imports in the app to use the new component.
- Answer key integration questions: what data/props to pass, any state management needed, responsive behaviour, where to place the component in the app.
Output format A step-by-step integration guide with code examples, file paths, and dependency lists. Use concise language appropriate for developers.
Guardrails
- Do not modify the component’s logic unless it conflicts with the project structure.
- Assume the user can run terminal commands; do not repeat basic instructions like 'open a terminal'.
- If the component requires specific context providers, list them clearly.
Example User input: (a React button component with Tailwind classes)