목록
목록 (List)
List는 정보를 행(row) 단위로 세로로 나열해서 보여주는 레이아웃 컴포넌트예요.
출처: 문서
본문
List는 음악 재생 목록, 연락처, 최근 항목처럼 행 단위 데이터를 보여줄 때 사용하는 컴포넌트예요. list 안에 list-row를 넣고, 그 안에 데이터를 세로로 나열하면 됩니다.
| 클래스명 | 타입 | 설명 |
|---|---|---|
list |
Component | 목록 행을 담는 세로 flex 레이아웃 |
list-row |
Component | list 안의 아이템. 데이터를 담는 가로 grid 레이아웃 |
list-col-wrap |
Modifier | list-row의 직계 자식 하나를 다음 줄로 밀어낼 때 사용 |
list-col-grow |
Modifier | list-row의 직계 자식 하나가 남은 공간을 채우도록 할 때 사용 |
기본적으로 list-row의 두 번째 자식이 남은 공간을 채워요. 다른 자식에 list-col-grow를 붙이면 그 자식이 대신 남은 공간을 채우게 됩니다.
List (두 번째 컬럼이 늘어남 - 기본값)
기본 동작에서는 두 번째 자식이 남은 공간을 채워요.
<ul class="list bg-base-100 rounded-box shadow-md">
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Most played songs this week</li>
<li class="list-row">
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div>
<div>Dio Lupa</div>
<div class="text-xs uppercase font-semibold opacity-60">Remaining Reason</div>
</div>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
<button class="btn btn-square btn-ghost">
<svg aria-label="Favorite" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path></g></svg>
</button>
</li>
<li class="list-row">
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div>
<div>Ellie Beilish</div>
<div class="text-xs uppercase font-semibold opacity-60">Bears of a fever</div>
</div>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
<button class="btn btn-square btn-ghost">
<svg aria-label="Favorite" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path></g></svg>
</button>
</li>
<li class="list-row">
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div>
<div>Sabrino Gardener</div>
<div class="text-xs uppercase font-semibold opacity-60">Cappuccino</div>
</div>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
<button class="btn btn-square btn-ghost">
<svg aria-label="Favorite" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path></g></svg>
</button>
</li>
</ul>
List (세 번째 컬럼이 늘어남)
순번을 첫 번째에 두고, 설명 컬럼에 list-col-grow를 붙여서 그 컬럼이 공간을 채우게 만들 수 있어요.
<ul class="list bg-base-100 rounded-box shadow-md">
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Most played songs this week</li>
<li class="list-row">
<div class="text-4xl font-thin opacity-30 tabular-nums">01</div>
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div class="list-col-grow">
<div>Dio Lupa</div>
<div class="text-xs uppercase font-semibold opacity-60">Remaining Reason</div>
</div>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
</li>
<li class="list-row">
<div class="text-4xl font-thin opacity-30 tabular-nums">02</div>
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div class="list-col-grow">
<div>Ellie Beilish</div>
<div class="text-xs uppercase font-semibold opacity-60">Bears of a fever</div>
</div>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
</li>
<li class="list-row">
<div class="text-4xl font-thin opacity-30 tabular-nums">03</div>
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div class="list-col-grow">
<div>Sabrino Gardener</div>
<div class="text-xs uppercase font-semibold opacity-60">Cappuccino</div>
</div>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
</li>
</ul>
List (세 번째 컬럼이 다음 줄로 넘어감)
설명 같은 긴 텍스트를 담는 자식에 list-col-wrap을 붙이면 그 아이템만 다음 줄로 감싸져서 내려가요.
<ul class="list bg-base-100 rounded-box shadow-md">
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Most played songs this week</li>
<li class="list-row">
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div>
<div>Dio Lupa</div>
<div class="text-xs uppercase font-semibold opacity-60">Remaining Reason</div>
</div>
<p class="list-col-wrap text-xs">
"Remaining Reason" became an instant hit, praised for its haunting sound and emotional depth. A viral performance brought it widespread recognition, making it one of Dio Lupa’s most iconic tracks.
</p>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
<button class="btn btn-square btn-ghost">
<svg aria-label="Favorite" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path></g></svg>
</button>
</li>
<li class="list-row">
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div>
<div>Ellie Beilish</div>
<div class="text-xs uppercase font-semibold opacity-60">Bears of a fever</div>
</div>
<p class="list-col-wrap text-xs">
"Bears of a Fever" captivated audiences with its intense energy and mysterious lyrics. Its popularity skyrocketed after fans shared it widely online, earning Ellie critical acclaim.
</p>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
<button class="btn btn-square btn-ghost">
<svg aria-label="Favorite" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path></g></svg>
</button>
</li>
<li class="list-row">
<div><img class="size-10 rounded-box" alt="Tailwind CSS list item" src="https://img.daisyui.com/images/profile/demo/[email protected]"/></div>
<div>
<div>Sabrino Gardener</div>
<div class="text-xs uppercase font-semibold opacity-60">Cappuccino</div>
</div>
<p class="list-col-wrap text-xs">
"Cappuccino" quickly gained attention for its smooth melody and relatable themes. The song’s success propelled Sabrino into the spotlight, solidifying their status as a rising star.
</p>
<button class="btn btn-square btn-ghost">
<svg aria-label="Play" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M6 3L20 12 6 21 6 3z"></path></g></svg>
</button>
<button class="btn btn-square btn-ghost">
<svg aria-label="Favorite" class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-linejoin="round" stroke-linecap="round" stroke-width="2" fill="none" stroke="currentColor"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"></path></g></svg>
</button>
</li>
</ul>
더 알아보기 (Learn more)
List는 재생 목록이나 데이터 행 목록을 보여줄 때 유용해요. 기본적으로 list-row의 두 번째 자식이 남은 공간을 채우고, list-col-grow로 다른 자식이 채우도록 바꾸거나 list-col-wrap으로 긴 텍스트를 다음 줄로 넘길 수 있습니다. 행 안에는 이미지, 텍스트, 버튼 등 어떤 요소든 자유롭게 배치할 수 있어요.