공식 문서 링크는 다음과 같다. 디테일한 건 공식 문서를 참고하자.
https://ui.shadcn.com/docs/installation/next
Next.js
Install and configure shadcn/ui for Next.js.
ui.shadcn.com
shadcn이란
리액트 ui 컴포넌트 라이브러리인 React MUI를 알 것이다. next.js에도 비슷한 게 있다. 그게 shadcn이다
Build your component library - shadcn/ui
A set of beautifully-designed, accessible components and a code distribution platform. Works with your favorite frameworks. Open Source. Open Code.
ui.shadcn.com
쉽게 말해서, UI를 만들기 쉽게 하는 라이브러리이다. 여러 UI를 지원해 준다. 버튼도 있고, 사이드바도 있고... 엄청 많다.
next.js를 쓸 거면 꼭 알아두는 것을 추천한다!
Next.js
Install and configure shadcn/ui for Next.js.
프로젝트에 설치하기
명령어 >
npx shadcn@latest init
이후 내가 원하는 "컴포넌트"를 별도로 가져올려면 추가로 npx 설치가 필요하다. 예를 들어 버튼 컴포넌트를 가져올 것이라면..
명령어 >
npx shadcn@latest add button
이후 컴포넌트를 다음 코드처럼 써주면 된다.
import { Button } from "@/components/ui/button"
export default function Home() {
return (
<div>
<Button>Click me</Button>
</div>
)
}
import를 해주고 컴포넌트처럼 써주면 끝.
더 많은 컴포넌트 예시
더 많은 UI 컴포넌트 예시가 궁금하면 다음 링크를 참고하자.
https://ui.shadcn.com/docs/components
Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
ui.shadcn.com
'FE > Next.js' 카테고리의 다른 글
Next.js에서 'use client'를 사용하는 경우 (0) | 2025.04.24 |
---|---|
Next.js를 이용한 포트원 결제 구현(테스트) (5) | 2025.04.18 |
Next.js의 Dynamic API 처리 (1) | 2025.04.06 |
Next.js의 기존 프로젝트에서 ts 추가하는 법 (0) | 2025.03.28 |
Next.js의 다이나믹 라우팅 (0) | 2025.03.22 |