创建项目
运行 init
命令来创建新的 Next.js 项目或设置现有项目。
您可以使用 -d
标志来使用默认值,例如 new-york
、zinc
和 yes
用于 CSS 变量。
配置 components.json
您将被问及几个问题来配置 components.json
。
Which style would you like to use? › New York
Which color would you like to use as base color? › Zinc
Do you want to use CSS variables for colors? › no / yes
就这样!
您现在可以开始向项目中添加组件了。
上述命令会将 Button
组件添加到您的项目中。您可以像这样导入它:
import { Button } from "@/components/ui/button";
export default function Home() {
return (
<div>
<Button>Click me</Button>
</div>
);
}