데이터와 피드백@neumorphism-ui/alert

Alert

아이콘, 제목, 설명을 정렬하는 조합형 Alert입니다. default, success, destructive 변형이 있으며 모든 변형이 색상 외에 테두리와 텍스트 대비를 함께 사용합니다.

@neumorphism-ui/alert
Registry JSON

미리보기

설치

설치: alertnpx shadcn@latest add @neumorphism-ui/alert

CLI가 npm 의존성, base 토큰, utils와 컴포넌트 소스를 순서대로 확인하고 설치합니다.

Registry를 처음 사용한다면 namespace 설정 을 먼저 완료하세요.

사용법

Import

Alert import 코드
import {
  Alert,
  AlertDescription,
  AlertTitle,
} from "@/components/ui/alert"

Example

Alert 사용 코드
<Alert variant="success">
  <svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><path d="m5 12 4 4L19 6" /></svg>
  <AlertTitle>저장했습니다</AlertTitle>
  <AlertDescription>
    변경 사항이 모든 팀원에게 반영되었습니다.
  </AlertDescription>
</Alert>

API 레퍼런스

컴포넌트속성타입기본값설명
Alertvariant"default" | "success" | "destructive""default"메시지의 의미와 시각적 상태를 선택합니다.
AlertchildrenReact.ReactNode—아이콘, AlertTitle, AlertDescription을 배치합니다.
AlertclassNamestring—기본 표면 스타일을 확장합니다.

접근성

  • 01

    Alert는 role=alert를 사용하므로 동적으로 나타나는 중요한 메시지에 적합합니다.

  • 02

    페이지 로드 때부터 보이는 일반 안내에는 role=alert의 즉시 읽기가 불필요할 수 있으므로 role을 덮어쓰거나 다른 컨테이너를 사용합니다.

  • 03

    장식 아이콘에는 aria-hidden=true를 지정하고 의미는 제목과 설명 텍스트로도 전달합니다.