알림
알림 (Alert)
Alert는 중요한 이벤트를 사용자에게 알려 주는 컴포넌트예요. 성공, 경고, 오류, 정보 같은 상황에 맞는 색과 스타일을 적용할 수 있어요.
출처: 문서
본문
| 클래스 이름 | 타입 |
|---|---|
alert |
Component — 컨테이너 요소 |
alert-outline |
Style — 아웃라인 스타일 |
alert-dash |
Style — 대시 아웃라인 스타일 |
alert-soft |
Style — 소프트 스타일 |
alert-info |
Color — info 색 |
alert-success |
Color — success 색 |
alert-warning |
Color — warning 색 |
alert-error |
Color — error 색 |
alert-vertical |
방향 — 세로 레이아웃, 모바일에 좋음 |
alert-horizontal |
방향 — 가로 레이아웃, 데스크톱에 좋음 |
Alert
<div role="alert" class="$$alert">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current text-info h-6 w-6 shrink-0">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<span>12 unread messages. Tap to see.</span>
</div>
Info 색
<div role="alert" class="$$alert $$alert-info">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="h-6 w-6 shrink-0 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<span>New software update available.</span>
</div>
Success 색
<div role="alert" class="$$alert $$alert-success">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>Your purchase has been confirmed!</span>
</div>
Warning 색
<div role="alert" class="$$alert $$alert-warning">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
<span>Warning: Invalid email address!</span>
</div>
Error 색
<div role="alert" class="$$alert $$alert-error">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>Error! Task failed successfully.</span>
</div>
Alert 소프트 스타일
<div role="alert" class="$$alert $$alert-info $$alert-soft">
<span>12 unread messages. Tap to see.</span>
</div>
<div role="alert" class="$$alert $$alert-success $$alert-soft">
<span>Your purchase has been confirmed!</span>
</div>
<div role="alert" class="$$alert $$alert-warning $$alert-soft">
<span>Warning: Invalid email address!</span>
</div>
<div role="alert" class="$$alert $$alert-error $$alert-soft">
<span>Error! Task failed successfully.</span>
</div>
Alert 아웃라인 스타일
<div role="alert" class="$$alert $$alert-info $$alert-outline">
<span>12 unread messages. Tap to see.</span>
</div>
<div role="alert" class="$$alert $$alert-success $$alert-outline">
<span>Your purchase has been confirmed!</span>
</div>
<div role="alert" class="$$alert $$alert-warning $$alert-outline">
<span>Warning: Invalid email address!</span>
</div>
<div role="alert" class="$$alert $$alert-error $$alert-outline">
<span>Error! Task failed successfully.</span>
</div>
Alert 대시 스타일
<div role="alert" class="$$alert $$alert-info $$alert-dash">
<span>12 unread messages. Tap to see.</span>
</div>
<div role="alert" class="$$alert $$alert-success $$alert-dash">
<span>Your purchase has been confirmed!</span>
</div>
<div role="alert" class="$$alert $$alert-warning $$alert-dash">
<span>Warning: Invalid email address!</span>
</div>
<div role="alert" class="$$alert $$alert-error $$alert-dash">
<span>Error! Task failed successfully.</span>
</div>
버튼 + 반응형이 있는 Alert
<div role="alert" class="$$alert $$alert-vertical sm:$$alert-horizontal">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current text-info h-6 w-6 shrink-0">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<span>we use cookies for no reason.</span>
<div>
<button class="$$btn $$btn-sm">Deny</button>
<button class="$$btn $$btn-sm $$btn-primary">Accept</button>
</div>
</div>
제목과 설명이 있는 Alert
<div role="alert" class="$$alert $$alert-vertical sm:$$alert-horizontal">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current text-info h-6 w-6 shrink-0">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<div>
<h3 class="font-bold">New message!</h3>
<div class="text-xs">You have 1 unread message</div>
</div>
<button class="$$btn $$btn-sm">See</button>
</div>
더 알아보기 (Learn more)
alert-vertical과 alert-horizontal을 반응형 prefix와 조합하면(mobile 가로/세로 전환) 모바일과 데스크톱 모두에서 자연스러운 알림을 만들 수 있어요. 색 수식어와 soft/outline/dash 스타일만 익숙해지면 거의 모든 알림 상황을 커버할 수 있어요.