본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

daisyUI 5 업그레이드 가이드

원문 보기 위키 갱신

기존 프로젝트를 Tailwind CSS 4와 daisyUI 5로 업그레이드하는 방법을 정리한 가이드예요. 특히 v4에서 v5로 가며 바뀐 클래스 이름들이 핵심이에요.

출처: 문서

본문

업그레이드 전에 다음을 먼저 읽어 보세요:

  1. Tailwind CSS 4 breaking changes
  2. daisyUI 5 release notes
  3. daisyUI 5 breaking changes

1. Tailwind CSS 업데이트

Tailwind CSS는 자동 업그레이드를 위한 CLI 도구를 제공해요. 이 도구가 새 Tailwind CSS 변경사항을 프로젝트에 자동 적용해 줘요.

  • 먼저 tailwind.config.js에서 daisyUI와 플러그인을 제거해서, Tailwind CSS 업그레이드 도구가 안전하게 CSS 파일로 교체할 수 있게 해요.

tailwind.config.js

module.exports = {
   content: ['./your-files/**/*.{html,js}'],
   // other stuff...
-  daisyui: {
-    themes: ['light', 'dark', 'cupcake'],
-  },
- plugins: [require("daisyui")],
}
  • 공식 Tailwind CSS 업그레이드 도구를 실행해요:

Terminal

npx @tailwindcss/upgrade

2. daisyUI 업데이트

  • daisyUI 5를 설치해요

Terminal

npm i -D daisyui@latest
  • CSS 파일에 daisyUI를 추가해요

app.css

@import "tailwindcss";
@plugin "daisyui";

또는 config에서 내장 테마를 활성화하려면:

app.css

@import "tailwindcss";
@plugin "daisyui" {
  themes: light --default, dark --prefersdark, cupcake;
}

이제 모든 것이 정상 동작할 거예요. 문제가 생기면 daisyUI Discord 서버에서 커뮤니티 도움을 받을 수 있어요.

v4에서 바뀐 점

이 항목들은 daisyUI 4에서 5로 가며 생긴 HTML 변경사항들이에요. 총 약 15개지만 전부 할 필요는 없고, 자신이 쓰는 것만 반영하면 돼요.

  • daisyUI 5의 새 기능은 release notes 페이지에서
  • 더 자세한 변경 내역은 changelogs 페이지에서 확인할 수 있어요.

Artboard

  • artboard와 phone-* 클래스를 모두 제거했어요. 이 클래스들은 div의 가로·세로 크기를 설정하는 것뿐이었거든요. 대신 Tailwind CSS의 w-*, h-* 클래스를 쓰세요.
Before After
artboard phone-1 w-[320px] h-[568px]
artboard phone-2 w-[375px] h-[667px]
artboard phone-3 w-[414px] h-[736px]
artboard phone-4 w-[375px] h-[812px]
artboard phone-5 w-[414px] h-[896px]
artboard phone-6 w-[320px] h-[1024px]
artboard artboard-horizontal phone-1 w-[568px] h-[320px]
artboard artboard-horizontal phone-2 w-[667px] h-[375px]
artboard artboard-horizontal phone-3 w-[736px] h-[414px]
artboard artboard-horizontal phone-4 w-[812px] h-[375px]
artboard artboard-horizontal phone-5 w-[896px] h-[414px]
artboard artboard-horizontal phone-6 w-[1024px] h-[320px]

예시:

page.html

- <div class="artboard phone-1">
+ <div class="w-[320px] h-[568px]">

Avatar

  • online 클래스를 avatar-online으로, offline을 avatar-offline으로, placeholder를 avatar-placeholder로 이름을 바꿨어요.

page.html

- <div class="avatar online">
+ <div class="avatar avatar-online">
  <div class="w-24 rounded-full">
    <img src="https://img.daisyui.com/images/stock/photo-1534528741775-53994a69daeb.webp" />
  </div>
</div>

page.html

- <div class="avatar offline">
+ <div class="avatar avatar-offline">
  <div class="w-24 rounded-full">
    <img src="https://img.daisyui.com/images/stock/photo-1534528741775-53994a69daeb.webp" />
  </div>
</div>

Bottom Navigation

  • bottom-nav 컴포넌트를 제거했어요. 대신 dock 컴포넌트를 쓰세요.
  • btm-nav-xs, btm-nav-sm, btm-nav-md, btm-nav-lg를 제거했어요. 대신 dock-xs, dock-sm, dock-md, dock-lg를 쓰세요.
  • btm-nav-active를 제거했어요. 대신 dock-active를 쓰세요.
  • bottom-nav의 disabled 클래스를 제거했어요. 더 나은 접근성을 위해 aria-disabled="true" 속성 또는(버튼이라면) disabled 속성을 쓰세요.

page.html

- <div class="btm-nav btm-nav-sm">
+ <div class="dock dock-sm">
  <button>🏠</button>
-   <button class="active">🍿</button>
+   <button class="dock-active">🍿</button>
  <button>⚙️</button>
</div>

Card

  • card-bordered가 card-border로 이름이 바뀌었어요.

page.html

- <div class="card card-bordered">
+ <div class="card card-border">
  • card-compact를 제거했어요. 대신 card-sm을 쓰세요.

page.html

- <div class="card card-compact">
+ <div class="card card-sm">

FileInput

  • 파일 입력이 이제 기본적으로 테두리를 가져요. 테두리를 없애려면 file-input-ghost를 쓰세요.
  • file-input-bordered를 제거했어요. 파일 입력은 이제 기본적으로 테두리가 있고, 테두리를 없애려면 file-input-ghost를 쓰세요.

page.html

- <input type="file" class="file-input file-input-bordered">
+ <input type="file" class="file-input">
  • Footer가 이제 기본적으로 세로 방향이에요. 원하는 화면 크기에서 가로로 하려면 footer-horizontal을 쓰세요.

page.html

- <footer class="footer">
+ <footer class="footer md:footer-horizontal">

Input

  • Input이 이제 기본 20rem 너비를 가지므로 w-full max-w-xs를 추가할 필요가 없어요.
  • input-border를 제거했어요. Input은 이제 기본적으로 테두리가 있고, 테두리를 없애려면 input-ghost를 쓰세요.
  • input-bordered 클래스를 제거했어요(더 이상 필요 없음).

before

<!-- Input with border -->
<input class="input input-bordered"/>

<!-- Input without border -->
<input class="input"/>

<!-- Input with 20rem width -->
<input class="input w-full max-w-xs"/>

after

<!-- Input with border -->
<input class="input"/>

<!-- Input without border -->
<input class="input input-ghost"/>

<!-- Input with consistent width -->
<input class="input"/>

Label

  • Label이 form 요소와 더 잘 호환되도록 리팩터링했어요. 자세한 내용은 label 문서를 참고하세요.

Mask

  • mask-square, mask-parallelogram, mask-parallelogram-2, mask-parallelogram-3, mask-parallelogram-4를 제거했어요. 이 mask 스타일들은 라이브러리에 더 이상 포함되지 않아요. 필요하다면 CSS를 직접 추가해야 해요.
  • 세로 menu가 더 이상 w-full이 아니에요. 전체 너비로 쓰려면 w-full을 쓰세요.
  • menu 항목의 disabled 클래스를 menu-disabled로 이름을 바꿨어요.
  • menu 항목의 active 클래스를 menu-active로 이름을 바꿨어요.
  • menu 항목의 focus 클래스를 menu-focus로 이름을 바꿨어요.

page.html

- <ul class="menu">
+ <ul class="menu w-full">

-   <li class="disabled"><a>disabled item</a></li>
+   <li class="menu-disabled"><a>disabled item</a></li>

-   <li class="active"><a>active item</a></li>
+   <li class="menu-active"><a>active item</a></li>

-   <li class="focus"><a>focus item</a></li>
+   <li class="menu-focus"><a>focus item</a></li>
</ul>

Mockup

  • mockup-phone의 camera 클래스를 mockup-phone-camera로 이름을 바꿨어요.
  • mockup-phone의 display 클래스를 mockup-phone-display로 이름을 바꿨어요.
  • mockup-phone-display

page.html

<div class="mockup-phone">
-  <div class="camera"></div>
+  <div class="mockup-phone-camera"></div>

-    <div class="display">
+    <div class="mockup-phone-display">

-    <div class="artboard artboard-demo phone-1">Hi.</div>
+    <div class="w-[320px] h-[568px]">Hi.</div>
  </div>
</div>

Select

  • Select가 이제 기본 20rem 너비를 가지므로 w-full max-w-xs나 max-w-none 클래스를 추가할 필요가 없어요.
  • select-border를 제거했어요. Select는 이제 기본적으로 테두리가 있고, 테두리를 없애려면 select-ghost를 쓰세요.

before

<!-- Select with border -->
<select class="select select-bordered">

<!-- Select without border -->
<select class="select">

<!-- Select with consistent width -->
<select class="select w-full max-w-xs">

after

<!-- Select with border -->
<select class="select">

<!-- Select without border -->
<select class="select select-ghost">

<!-- Select with consistent width -->
<select class="select">

Stack

  • stack 항목들의 가로·세로 크기를 설정하는 대신, stack 자체에 가로·세로 크기를 설정하세요.

page.html

- <div class="stack">
-   <div class="card bg-base-100 w-36 h-36">Text</div>
-   <div class="card bg-base-100 w-36 h-36">Text</div>
-   <div class="card bg-base-100 w-36 h-36">Text</div>
+ <div class="stack w-36 h-32">
+   <div class="card bg-base-100">Text</div>
+   <div class="card bg-base-100">Text</div>
+   <div class="card bg-base-100">Text</div>
</div>

Stat

  • stats 배경색이 이제 투명해요. 배경색이 필요하면 bg-base-100을 쓰세요.

Tab

  • tabs-bordered를 tabs-border로 이름을 바꿨어요.

page.html

- <div class="tabs tabs-bordered">
+ <div class="tabs tabs-border">
  • tabs-lifted를 tabs-lift로 이름을 바꿨어요.

page.html

- <div class="tabs tabs-lifted">
+ <div class="tabs tabs-lift">
  • tabs-boxed를 tabs-box로 이름을 바꿨어요.

page.html

- <div class="tabs tabs-boxed">
+ <div class="tabs tabs-box">

Table

  • hover 클래스를 제거했어요. 대신 hover:bg-base-300(또는 다른 색)을 쓰세요.

page.html

- <tr class="hover">
+ <tr class="hover:bg-base-300">

Textarea

  • textarea-border를 제거했어요. Textarea는 이제 기본적으로 테두리가 있고, 테두리를 없애려면 textarea-ghost를 쓰세요.

기타 제거 사항

  • form-control, label-text, label-text-alt를 제거했어요.

HTML은 그대로 써도 되지만, 이 클래스 이름들은 더 이상 존재하지 않아 색상, 글자 크기, flex 등을 적용하지 않아요. 더 나은 접근성을 위해 fieldset과 legend 요소용으로 새로 추가된 클래스 이름을 쓰는 걸 권장해요.

before

<label class="form-control w-full max-w-xs">
  Login
  <div class="label">
    <span class="label-text">Name</span>
  </div>
  <input class="input" placeholder="Name" />
</label>

after

<fieldset class="fieldset">
  <legend>Login</legend>
  <label class="label" for="name">Name</label>
  <input id="name" class="input" placeholder="Name" />
</fieldset>

before

<label class="form-control w-full max-w-xs">
  <div class="label">
    <span class="label-text">What is your name?</span>
    <span class="label-text-alt">Top Right label</span>
  </div>
  <input type="text" placeholder="Type here" class="input input-bordered w-full max-w-xs" />
  <div class="label">
    <span class="label-text-alt">Bottom Left label</span>
    <span class="label-text-alt">Bottom Right label</span>
  </div>
</label>

after

<fieldset class="fieldset max-w-xs">
  <label class="label flex justify-between" for="name">
    <span>What is your name?</span>
    <span>Top Right label</span>
  </label>
  <input id="name" class="input" placeholder="Name" />
  <label class="label flex justify-between" for="name">
    <span>Bottom Left label</span>
    <span>Bottom Right label</span>
  </label>
</fieldset>
  • btn-group과 input-group을 제거했어요.

btn-group, input-group은 작년부터 deprecated 되었고 이제 마침내 제거됐어요. 이들을 쓰고 있었다면 join을 쓰면 돼요.

before

<div class="btn-group">
  <button class="btn">Button 1</button>
  <button class="btn">Button 2</button>
</div>

after

<div class="join">
  <button class="btn join-item">Button 1</button>
  <button class="btn join-item">Button 2</button>
</div>

더 알아보기 (Learn more)

v4→v5 전환은 대부분 "클래스 이름이 바뀌었다"는 점으로 요약돼요. artboard→w-* h-*, btn-group→join, form-control→fieldset 같은 변화만 기억해 두면 자신이 쓰는 부분만 골라서 빠르게 고칠 수 있어요.