☰ Categories

21st.dev component prompt

given a task to integrate an existing React component in the codebase.

CategoryDevelopment › Coding
TagsAnalyzingDraftingDeveloperCode
Prompt
You are given a task to integrate an existing React component in the codebase.

The codebase should support:
- shadcn project structure  
- Tailwind CSS
- Typescript

If it doesn't, provide instructions on how to setup project via shadcn CLI, install Tailwind or Typescript.

Determine the default path for components and styles. 
If default path for components is not /components/ui, provide instructions on why it's important to create this folder
Copy-paste this component to /components/ui folder:

${21st.dev_component}

Implementation Guidelines
 1. Analyze the component structure and identify all required dependencies
 2. Review the component's argumens and state
 3. Identify any required context providers or hooks and install them
 4. Questions to Ask
 - What data/props will be passed to this component?
 - Are there any specific state management requirements?
 - Are there any required assets (images, icons, etc.)?
 - What is the expected responsive behavior?
 - What is the best place to use this component in the app?

Steps to integrate
 0. Copy paste all the code above in the correct directories
 1. Install external dependencies
 2. Fill image assets with Unsplash stock images you know exist
 3. Use lucide-react icons for svgs or logos if component requires them

What this prompt does

Use this to integrate a 21st.dev React component into a shadcn, Tailwind CSS, and TypeScript codebase. If the project is not ready, it asks for setup guidance using the relevant tools.

Model comparison

ChatGPT is strongest in repository specificity and concision. Gemini is thorough but over-modifies and runs long, while [C] is absent.

ChatGPTTop overall
45/ 50

+ Precisely reflects the repository state and test results.

- It does not explicitly ask all five required questions.

Gemini
36/ 50

+ Systematically covers setup, usage, and key questions.

- It alters the requested code and is unnecessarily lengthy.

CriterionChatGPTGeminiLeader
Instruction following87ChatGPT +14%
Accuracy97ChatGPT +29%
Specificity107ChatGPT +43%
Structure99Tie
Right length96ChatGPT +50%

Scored 1–10 by gpt-5.6-sol with model names hidden (2026-09-24). This is an AI review, not a measurement.

Read full answers

We gave three models the same input and copied their answers unedited. Each ran in its CLI (an agent harness), and answers in the ChatGPT or Claude apps or on the web may differ. Outputs are in Korean.

Input used
[Pasted material]
'use client'
import { Star } from 'lucide-react'

export function PricingCard({ plan, price, features, highlighted }: { plan: string; price: string; features: string[]; highlighted?: boolean }) {
  return (
    <div className={`rounded-2xl border p-6 ${highlighted ? 'border-primary shadow-lg' : 'border-border'}`}>
      <h3 className='text-lg font-semibold'>{plan}</h3>
      <p className='mt-2 text-3xl font-bold'>{price}</p>
      <ul className='mt-4 space-y-2'>
        {features.map((f) => (
          <li key={f} className='flex items-center gap-2 text-sm'>
            <Star className='h-4 w-4' />
            {f}
          </li>
        ))}
      </ul>
    </div>
  )
}
gpt-5.6-luna (codex CLI · 에이전트 하네스) · Run on 2026-09-24

확인 결과:

  • components/ui/pricing-card.tsx는 요청한 코드와 이미 일치합니다.
  • lucide-react는 설치되어 있습니다.
  • components/ui 경로도 이미 존재합니다.
  • 현재 프로젝트에는 TypeScript, Tailwind CSS, shadcn 설정(components.json)이 없습니다.
  • 스타일은 style.css, nightfall.css 기반이며 Tailwind 전역 스타일이 아닙니다.
  • Unsplash 이미지나 추가 context/provider는 필요하지 않습니다.
  • npm test 결과 11개 테스트 모두 통과했습니다.

컴포넌트 사용 예:

import { PricingCard } from "@/components/ui/pricing-card"

<PricingCard
  plan="Pro"
  price="$29/month"
  highlighted
  features={["Unlimited projects", "Priority support", "Advanced analytics"]}
/>

현재 컴포넌트는 plan, price, features, 선택적 highlighted props만 사용하며 내부 state나 provider는 없습니다. 반응형 전용 클래스는 없으므로 부모 레이아웃에서 그리드/너비를 지정해야 합니다.

새로운 React + TypeScript 프로젝트로 구성하려면:

npm create vite@latest pricing-ui -- --template react-ts
cd pricing-ui
npm install
npm install tailwindcss @tailwindcss/vite lucide-react
npm install -D @types/node
npx shadcn@latest init

Vite 설정에는 Tailwind 플러그인을 추가하고, 전역 CSS에는 다음을 넣습니다.

@import "tailwindcss";

shadcn의 Vite 설치 방식은 src/components/ui를 기본 컴포넌트 경로로 사용합니다. 현재 저장소처럼 루트에 둘 경우에도 components/ui를 유지하는 것이 CLI import alias와 컴포넌트 탐색 규칙을 일관되게 유지하는 데 중요합니다. 공식 설정은 src/components/ui를 기준으로 합니다. (shadcn Vite 설치 문서, Tailwind Vite 설치 문서)

주의할 점은 현재 컴포넌트가 border-primary, border-border 같은 shadcn 테마 토큰을 사용한다는 것입니다. Tailwind/shadcn 테마가 설정되지 않은 현재 프로젝트에서는 해당 클래스가 시각적으로 적용되지 않을 수 있습니다.

More in this category

12-Month AI and Computer Vision Roadmap for Defense Applications
2046 Puzzle Game Challenge
3D FACTORY
3D FPS Game
3D Kinetic Ball Simulation