Tailwind CSS 리스트 그룹 (List Group)
리스트 그룹 컴포넌트는 사이드바와 비슷하게 하나의 카드 컴포넌트 안에 일련의 요소, 버튼, 링크를 표시하는 데 사용할 수 있어요.
출처: 문서
본문
기본 리스트 그룹
바로 사용할 수 있는 리스트 그룹 예시예요.
<ul class="w-48 text-sm font-medium text-heading bg-neutral-primary-soft border border-default rounded-base">
<li class="w-full px-4 py-2 border-b border-default rounded-t-lg">Profile</li>
<li class="w-full px-4 py-2 border-b border-default">Settings</li>
<li class="w-full px-4 py-2 border-b border-default">Messages</li>
<li class="w-full px-4 py-2 rounded-b-lg">Download</li>
</ul>
링크가 있는 리스트 그룹
리스트 그룹 안에 일련의 링크를 표시할 수도 있어요. 활성 항목에는 aria-current="true"를 붙이고, 호버/포커스 시 배경과 텍스트 색이 바뀌도록 스타일을 지정해요.
<div class="w-48 text-sm font-medium text-heading bg-neutral-primary-soft border border-default rounded-base">
<a href="#" aria-current="true" class="block w-full px-4 py-2 text-fg-brand bg-neutral-secondary-medium border-b border-default rounded-t-base cursor-pointer">
Profile
</a>
<a href="#" class="block w-full px-4 py-2 border-b border-default cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
Settings
</a>
<a href="#" class="block w-full px-4 py-2 border-b border-default cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
Messages
</a>
<a href="#" class="block w-full px-4 py-2 rounded-b-base cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
Download
</a>
</div>
버튼이 있는 리스트 그룹
리스트 그룹 컴포넌트 안에 버튼 요소 목록을 표시할 수도 있어요. 아래 예시에는 활성(active)과 비활성(disabled) 항목도 함께 포함되어 있어요.
<div class="w-48 text-sm font-medium text-heading bg-neutral-primary-soft border border-default rounded-base">
<button aria-current="true" type="button" class="w-full px-4 py-2 font-medium text-left rtl:text-right text-fg-brand bg-neutral-secondary-medium border-b border-default rounded-t-base cursor-pointer focus:outline-none">
Profile
</button>
<button type="button" class="w-full px-4 py-2 font-medium text-left rtl:text-right border-b border-default cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
Settings
</button>
<button type="button" class="w-full px-4 py-2 font-medium text-left rtl:text-right border-b border-default cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
Messages
</button>
<button type="button" class="w-full px-4 py-2 font-medium text-left rtl:text-right border-b border-default cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
Options
</button>
<button disabled type="button" class="w-full px-4 py-2 font-medium text-left rtl:text-right rounded-b-base cursor-not-allowed text-fg-disabled">
Download
</button>
</div>
아이콘이 있는 리스트 그룹
SVG 아이콘과 함께 버튼 목록을 메뉴로 만드는 예시예요.
<div class="w-48 text-sm font-medium text-heading bg-neutral-primary-soft border border-default rounded-base">
<a href="#" aria-current="true" class="flex items-center w-full px-4 py-2 text-fg-brand bg-neutral-secondary-medium border-b border-default rounded-t-base cursor-pointer">
<svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0 0a8.949 8.949 0 0 0 4.951-1.488A3.987 3.987 0 0 0 13 16h-2a3.987 3.987 0 0 0-3.951 3.512A8.948 8.948 0 0 0 12 21Zm3-11a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/></svg>
Profile
</a>
<a href="#" class="flex items-center w-full px-4 py-2 border-b border-default cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
<svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M20 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6h-2m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4"/></svg>
Settings
</a>
<a href="#" class="flex items-center w-full px-4 py-2 border-b border-default cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
<svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 13h3.439a.991.991 0 0 1 .908.6 3.978 3.978 0 0 0 7.306 0 .99.99 0 0 1 .908-.6H20M4 13v6a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-6M4 13l2-9h12l2 9M9 7h6m-7 3h8"/></svg>
Messages
</a>
<a href="#" class="flex items-center w-full px-4 py-2 rounded-b-base cursor-pointer hover:bg-neutral-secondary-medium hover:text-fg-brand focus:outline-none focus:ring-2 focus:ring-brand focus:text-fg-brand">
<svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 13V4M7 14H5a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2m-1-5-4 5-4-5m9 8h.01"/></svg>
Download
</a>
</div>
기능(features) 리스트 그룹
카드 컴포넌트에 아이콘이 있는 기능 목록을 표시하는 예시예요. 사용 가능한 기능에는 체크 아이콘을, 사용할 수 없는 기능에는 line-through 취소선을 사용해요.
<div class="w-72 bg-neutral-primary-soft border border-default rounded-base shadow-xs">
<ul role="list" class="space-y-4 p-6">
<li class="flex items-center">
<svg class="w-5 h-5 shrink-0 text-fg-brand me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
<span class="text-body">2 team members</span>
</li>
<li class="flex items-center">
<svg class="w-5 h-5 shrink-0 text-fg-brand me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
<span class="text-body">20GB Cloud storage</span>
</li>
<li class="flex items-center line-through decoration-body">
<svg class="w-5 h-5 shrink-0 text-fg-brand me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
<span class="text-body">Sketch Files</span>
</li>
<li class="flex items-center line-through decoration-body">
<svg class="w-5 h-5 shrink-0 text-fg-brand me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
<span class="text-body">API Access</span>
</li>
<li class="flex items-center line-through decoration-body">
<svg class="w-5 h-5 shrink-0 text-fg-brand me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
<span class="text-body">Complete documentation</span>
</li>
<li class="flex items-center line-through decoration-body">
<svg class="w-5 h-5 shrink-0 text-fg-brand me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
<span class="text-body">24×7 phone support</span>
</li>
</ul>
</div>
구분선이 있는 통계 리스트
카드 컴포넌트에 통계 데이터 목록을 표시하는 예시예요. divide-y 클래스로 구분선을 넣고 각 항목을 라벨과 값으로 구성해요.
<div class="w-96 bg-neutral-primary-soft border border-default rounded-base shadow-xs">
<ul role="list" class="space-y-3 p-6 divide-y divide-default">
<li class="flex items-center justify-between pb-3">
<div class="flex items-center text-body">
<svg class="w-5 h-5 me-1.5 shrink-0" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v5m-3 0h6M4 11h16M5 15h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1Z"/></svg>
<span>Electronics</span>
</div>
<span class="text-body font-medium">$5B</span>
</li>
<li class="flex items-center justify-between pb-3">
<div class="flex items-center text-body">
<svg class="w-5 h-5 me-1.5 shrink-0" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 12 8-8 8 8M6 10.5V19a1 1 0 0 0 1 1h3v-3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3h3a1 1 0 0 0 1-1v-8.5"/></svg>
<span>Home Furnishings</span>
</div>
<span class="text-body font-medium">$1.8B</span>
</li>
</ul>
</div>
최신 사용자 리스트
프로필 사진과 팔로우·삭제(툴팁 포함) 버튼을 갖춘 사용자 리스트 예시예요.
<div class="w-full max-w-sm p-6 bg-neutral-primary-soft border border-default rounded-base shadow-xs">
<h5 class="text-xl font-semibold text-heading mb-6">Latest users</h5>
<div class="flow-root">
<ul role="list" class="divide-y divide-default">
<li class="pb-4 sm:pb-4">
<div class="flex items-center gap-2">
<div class="shrink-0">
<img class="w-8 h-8 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Neil image">
</div>
<div class="flex-1 min-w-0">
<p class="font-medium text-heading truncate">Neil Sims</p>
<p class="text-sm text-body truncate">neil@windster.com</p>
</div>
</div>
</li>
</ul>
</div>
</div>
더 알아보기 (Learn more)
- List Group 문서 (공식)
- 기본·링크·버튼·아이콘·기능·통계·사용자 목록 등 다양한 변형으로 활용할 수 있어요.