- Replace .eslintrc.cjs with eslint.config.mjs (ESLint 9 flat config)
using direct eslint-plugin-solid + @typescript-eslint/parser approach
- Add @typescript-eslint/parser to root devDependencies
- Add main/module/types top-level fields to packages/core/package.json
- Add resolve.conditions to packages/core/vite.config.ts
- Create packages/core/tsconfig.test.json for test type-checking
- Remove empty paths:{} from packages/core/tsconfig.json
149 lines
11 KiB
Markdown
149 lines
11 KiB
Markdown
[Stop Rebuilding UI From ScratchStop Rebuilding UI](https://www.shadcn.io/pricing)
|
|
|
|
Shadcn.io is not affiliated with official [shadcn/ui](https://ui.shadcn.com/)
|
|
|
|
[Previous: Shadcn UI React Components](https://www.shadcn.io/ui) Ask AI
|
|
|
|
[Discord](https://discord.gg/Z9NVtNE7bj "Join Discord") [GitHub](https://github.com/shadcnio/react-shadcn-components "View on GitHub") [Next: Shadcn Installation Guide](https://www.shadcn.io/ui/installation-guide)
|
|
|
|
# Why AI Coding Tools Love Shadcn UI
|
|
|
|
Why shadcn UI works perfectly with AI coding tools like Cursor, Copilot, and v0. Copy-paste React components with TypeScript for Next.js applications.
|
|
|
|
Table of Contents
|
|
|
|
# [Why AI Coding Tools Love React Components You Actually Own](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#why-ai-coding-tools-love-react-components-you-actually-own)
|
|
|
|
Building React applications with AI coding tools in 2024 means your AI assistant needs to understand your components. Ask it to "make the button green and add a loading spinner" with most UI libraries, and your AI basically throws up its hands. "Well, you could try overriding the theme... or maybe use a CSS class... actually, let me check the docs..." Sound familiar?
|
|
|
|
But with shadcn/ui React components? Your AI just opens up `components/ui/button.tsx`, sees exactly how everything works with TypeScript, changes `bg-blue-500` to `bg-green-500`, tosses in a spinner, updates the props interface. Boom. Done.
|
|
|
|
Here's what nobody talks about: the best React component library for AI coding tools isn't the one with the most features—it's the one your AI can actually read and modify with TypeScript.
|
|
|
|
## [The black box problem we've all lived with](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#the-black-box-problem-weve-all-lived-with)
|
|
|
|
Look, we've all been there. You're using Material UI or Chakra in your Next.js application, and you want to make one tiny change to a React component. You end up in this rabbit hole of theme providers, style overrides, and documentation diving. It's frustrating enough when you're doing it yourself.
|
|
|
|
Now imagine your AI coding tool trying to help. It's basically playing blind chess. All the actual component logic is compiled and hidden away in `node_modules`. Your AI can see the public API, sure, but it has no clue how anything actually works under the hood with TypeScript.
|
|
|
|
Want to modify a button's behavior? Your AI starts guessing: "Maybe try the theme object? Or this CSS-in-JS prop? Actually, let me search the docs..." Meanwhile, you're sitting there thinking, "Just change the damn button."
|
|
|
|
## [shadcn/ui flipped the script](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#shadcnui-flipped-the-script)
|
|
|
|
Here's what shadcn/ui did differently. Instead of giving you another black box library, it just... gives you the code. Seriously, that's it.
|
|
|
|
Run `npx shadcn@latest add button` and boom—you've got a `button.tsx` file with TypeScript sitting right there in your Next.js codebase. Your AI coding tool can read it like any other React component in your project. No mysteries, no abstractions, no "the magic happens elsewhere."
|
|
|
|
And here's the kicker: it's all built with Tailwind CSS. Classes like `bg-primary hover:bg-primary/90` tell the whole story. Your AI doesn't need to decode some complex theme system—it can literally see that hovering makes the background 90% opacity.
|
|
|
|
Want a loading state? Your AI looks at the component, sees how variants work, and just... adds one. No theme provider wrestling, no API limitations. Just code doing what code does.
|
|
|
|
```
|
|
// Before: Simple button
|
|
<Button variant="default">Click me</Button>
|
|
|
|
// After: AI adds loading state by reading the component
|
|
<Button variant="default" loading={isLoading}>
|
|
{isLoading ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : null}
|
|
Click me
|
|
</Button>
|
|
```
|
|
|
|
## [Why AI gets shadcn/ui so well](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#why-ai-gets-shadcnui-so-well)
|
|
|
|
Think about it—AI is really good at pattern recognition and code modification. But it's only as good as what it can see.
|
|
|
|
With Tailwind CSS, everything's explicit in your React components. `text-blue-500` always means the same thing. Your AI coding tool reads `hover:bg-blue-600 focus:ring-2 focus:ring-blue-500` and immediately knows what's going on. No theme system to decode, no CSS-in-JS abstractions to parse in your TypeScript files.
|
|
|
|
After your AI sees a couple shadcn/ui React components, it starts picking up on the patterns. How variants work with TypeScript, how you structure Next.js layouts, even your accessibility patterns. It's like having a junior dev who learns your coding style really, really fast.
|
|
|
|
The difference? With traditional libraries, all these patterns are hidden in theme configs and style overrides. With shadcn/ui, they're right there in the component files where your AI can see them.
|
|
|
|
```
|
|
// What your AI sees in button.tsx
|
|
const buttonVariants = cva(
|
|
"inline-flex items-center justify-center rounded-md text-sm font-medium",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
destructive:
|
|
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
outline: "border border-input bg-background hover:bg-accent",
|
|
// AI can easily add new variants here
|
|
loading: "bg-primary/50 text-primary-foreground cursor-not-allowed",
|
|
},
|
|
},
|
|
}
|
|
);
|
|
```
|
|
|
|
## [What this actually means for your workflow](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#what-this-actually-means-for-your-workflow)
|
|
|
|
Here's the crazy part: shadcn/ui wasn't designed for AI at all. It was designed to solve the developer control problem. But in doing that, it accidentally solved the AI problem too.
|
|
|
|
Your AI coding tool doesn't need docs anymore—it just reads your React components with TypeScript. When it suggests changes, they actually work because it understands the real implementation in your Next.js application, not some abstract API description. And the more you customize your components, the better your AI gets at understanding your specific style.
|
|
|
|
## [The bigger pattern emerging](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#the-bigger-pattern-emerging)
|
|
|
|
You know what's interesting? This transparency thing isn't just winning in React and Next.js development. Look around—AI coding tools work better with anything they can actually read and understand.
|
|
|
|
Terraform configs vs complex deployment abstractions. Raw SQL schemas vs ORM magic. OpenAPI specs vs undocumented REST APIs. TypeScript interfaces vs any types. Every time, the transparent, declarative approach wins when AI gets involved.
|
|
|
|
shadcn/ui just happened to stumble onto this principle first in the React component library space. But the pattern is clear: if you want to build something that works well with AI coding tools, make it readable with TypeScript, make it explicit, and put it where AI can see it in your Next.js codebase.
|
|
|
|
## [What comes next](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#what-comes-next)
|
|
|
|
We're still in the early days, but the trajectory is clear. As AI coding tools get better at understanding React component patterns with TypeScript, they amplify shadcn/ui's transparency advantage. More Next.js projects adopt these patterns, creating better training data, which makes AI tools even more effective. It's a virtuous cycle.
|
|
|
|
We're not just building better UIs anymore. We're building UIs that think.
|
|
|
|
## [The simple truth](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#the-simple-truth)
|
|
|
|
Here's the beautiful part: you don't need to change anything. Use shadcn/ui React components with TypeScript exactly as you normally would in your Next.js application. The AI compatibility comes from the transparency, not special APIs or patterns.
|
|
|
|
shadcn/ui accidentally solved the AI coding tool compatibility problem by solving the developer control problem. When you own your React component code with TypeScript, both you and your AI can understand it. The result? A development experience that feels like having a pair programmer who actually understands your Next.js codebase.
|
|
|
|
## [AI-Friendly Components to Try](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#ai-friendly-components-to-try)
|
|
|
|
These React components work exceptionally well with AI coding tools because of their transparent, readable structure:
|
|
|
|
[**Button** \\
|
|
Variants and states that AI can easily read and modify](https://www.shadcn.io/ui/button) [**Input** \\
|
|
Form components with clear TypeScript interfaces](https://www.shadcn.io/ui/input) [**Dialog** \\
|
|
Complex components AI can understand and customize](https://www.shadcn.io/ui/dialog) [**Form** \\
|
|
Validation patterns AI can replicate and extend](https://www.shadcn.io/ui/form) [**Data Table** \\
|
|
Advanced components with clear sorting and filtering logic](https://www.shadcn.io/ui/data-table) [**Command** \\
|
|
Search interfaces AI can enhance with new features](https://www.shadcn.io/ui/command)
|
|
|
|
## [Ready to try it yourself?](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#ready-to-try-it-yourself)
|
|
|
|
Pick your framework and get started with shadcn/ui. The [installation guide](https://www.shadcn.io/ui/installation-guide) walks you through setup for Next.js, Vite, Remix, and more. Takes about 5 minutes to get your first component working.
|
|
|
|
Once you're set up, here's where to go next:
|
|
|
|
1. Browse [official components](https://www.shadcn.io/ui) for forms, tables, and UI elements
|
|
2. Add [charts](https://www.shadcn.io/charts) for data visualization
|
|
3. Explore [community components](https://www.shadcn.io/components) for extended functionality
|
|
4. Add useful [hooks](https://www.shadcn.io/hooks) to enhance your components
|
|
5. Use pre-built [blocks](https://www.shadcn.io/blocks) to quickly build common layouts
|
|
|
|
Then ask your AI assistant to modify something. Watch it actually understand your components instead of guessing from docs. You'll never want to go back to black box libraries again.
|
|
|
|
## [Questions you're probably thinking](https://www.shadcn.io/ui/why-ai-coding-tools-love-shadcn-ui\#questions-youre-probably-thinking)
|
|
|
|
### Do I need to learn new patterns for AI-assisted development?
|
|
|
|
### Will this work with future AI coding tools?
|
|
|
|
### Are other libraries adopting this approach?
|
|
|
|
Was this page helpful?
|
|
|
|
[Sign in](https://www.shadcn.io/sign-in) to leave feedback.
|
|
|
|
[Shadcn UI React Components\\
|
|
\\
|
|
Copy-paste React components built with Radix UI and Tailwind CSS. Open source component library for Next.js with TypeScript support and full code ownership.](https://www.shadcn.io/ui) [Shadcn Installation Guide\\
|
|
\\
|
|
Setup guides for shadcn/ui with Next.js, Vite, Remix, Laravel, Astro, and more React frameworks. Get started with TypeScript components quickly.](https://www.shadcn.io/ui/installation-guide) |