shadcn/ui 上手教程:从初始化到使用
只要你最近两年写过 React,大概率绕不开 shadcn/ui。它第一眼看上去平平无奇,用过之后却会悄悄改变你对"组件库"这件事的理解。这篇就讲讲怎么在真实项目里把它跑起来。
Getting Started with shadcn/ui: A Practical Guide
If you have built a React app in the last couple of years, you have probably run into shadcn/ui. It is one of those tools that looks deceptively simple at first and then quietly changes how you think about component libraries. This post is a short, practical guide to getting it running in a real project.
It is not a component library (really)
The first thing worth understanding is what shadcn/ui actually is, because it does not work like the libraries you may be used to. There is no big package that lives in node_modules and that you import a <Button> from. Instead, when you ask for a component, the CLI copies the actual source code into your project. The button you end up importing is your code: