Skip to content

CSS: alert

.instui-alert · stable — 상태 색 표시줄과 공유 아이콘 세트에서 마스킹된 상태 글리프가 있는 인라인 메시지입니다.

사용자 정의 -icon-<name>는 상태 글리프를 교체하지만 변형의 색상 막대는 유지합니다; 막대 채우기는 더 높은 특이성에서 재적용되어 공유 아이콘 페인터가 이를 사용하지 못하게 합니다. 직접 닫기 버튼은 기본적으로 작은 크기이며, 덮어쓰려면 크기 수식자를 추가하세요.

Source: alert.css

TIP

JS 향상 — 이 컴포넌트의 CSS는 자체적으로 렌더링되어 동작합니다; 상호작용 동작을 추가하려면 @pantoken/interactions와 함께 사용하세요. 그 -timeout 수식자는 해당 동작에 의해 제어됩니다. 아래 수식자 표를 참고하세요.

접근성

중요한 메시지의 경우, role="alert" 또는 aria-live 영역을 추가하여 보조 기술이 이를 발표하게 하세요; 해제 컨트롤은 라벨이 있는 닫기 버튼이며(예제의 .instui-close-buttonaria-label="Close"을 포함합니다).

사용법

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/alert.css";

예제들

html
<div class="instui-alert -icon-megaphone --mb-md">
  An alert with the default <code>info</code> color, and a custom icon.
</div>
<div class="instui-alert -color-success">
  Congratulations! You're using the "success" color.
  <button class="instui-close-button" aria-label="Close"></button>
</div>

구조

text
.instui-alert
  ‹content›
  close-button (component, 0..1)
flowchart TD n0[".instui-alert"]:::cssdoc-root n1[/"‹content›"/]:::cssdoc-slot n2(["close-button"]):::cssdoc-component n0 --> n1 n0 -.->|0..1| n2 click n2 "/api/css/close-button.md" classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

슬롯

슬롯설명
content경고의 메시지 내용; 해제 버튼을 포함할 수 있습니다.

수정자

수정자설명
.-color-danger오류 메시지입니다.
.-color-info정보성(기본).
.-color-success긍정/확인 메시지입니다.
.-color-warning주의를 요하는 메시지입니다.
.-has-shadow-falseAlias — maps to .-without-shadow.
.-icon-*상태 글리프를 사용자 아이콘(예: -icon-megaphone)으로 교체하세요. 변형의 색막대 위에서 흰색으로 유지됩니다.
.-render-custom-icon-*더 이상 사용되지 않음 — The former renderCustomIcon prop; still works as an alias, but use -icon-<name> (or override --pantoken-alert-glyph) instead.
.-screen-reader-only시각적으로 숨겨지지만 발표됩니다.
.-timeoutInteraction — The alert will automatically dismiss after a default of 5 seconds.
.-timeout-1자동 해제 1초 전.
.-timeout-2자동 해제 2초 전.
.-timeout-3자동 해제 3초 전.
.-timeout-4자동 해제 4초 전.
.-timeout-5자동 해제 5초 전.
.-variant-error더 이상 사용되지 않음 — use .-color-danger.
.-variant-info더 이상 사용되지 않음 — use .-color-info.
.-variant-success더 이상 사용되지 않음 — use .-color-success.
.-variant-warning더 이상 사용되지 않음 — use .-color-warning.
.-without-shadow기본 엘리베이션 그림자 제거(InstUI hasShadow={false}).

의사 요소

의사 요소설명
::after흰색 상태 글리프, 마스킹되어 막대 중앙에 배치됩니다.
::before둥근 시작 가장자리에 맞춘 실색 변형의 상태 막대입니다.

사용자 정의 속성

속성타입기본설명
--pantoken-alert-glyph<url>저수준 상태 글리프 소스; -icon-<name>가 이를 설정해 줍니다. 사용자 아이콘(URL 인코딩된 SVG)으로 오버라이드할 수 있습니다.
--pantoken-alert-icon-bg<color>글리프 뒤의 색상 상태 막대 채우기; 각 -color-* 변형이 자체 색을 설정합니다.
--timeout<integer>자동 해제까지의 밀리초; 0는 이를 비활성화합니다. 경고 상호작용 번들이 필요합니다.

사용된 토큰

Token타입
--instui-component-alert-background<color>LightDarklight-dark(#ffffff, #171B21)
--instui-component-alert-border-radius<length>0.75rem
--instui-component-alert-border-stylesolid
--instui-component-alert-border-width<length>0.125rem
--instui-component-alert-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-component-alert-content-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-alert-content-font-size<length>1rem
--instui-component-alert-content-font-weight<integer>400
--instui-component-alert-content-line-height<percentage>125%
--instui-component-alert-content-padding-horizontal<length>1.5rem
--instui-component-alert-content-padding-vertical<length>0.75rem
--instui-component-alert-danger-border-color<color>#E62429
--instui-component-alert-danger-icon-background<color>#E62429
--instui-component-alert-icon-color<color>#ffffff
--instui-component-alert-info-border-color<color>#2B7ABC
--instui-component-alert-info-icon-background<color>#2B7ABC
--instui-component-alert-success-border-color<color>#03893D
--instui-component-alert-success-icon-background<color>#03893D
--instui-component-alert-warning-border-color<color>#CF4A00
--instui-component-alert-warning-icon-background<color>#CF4A00
--instui-component-base-button-medium-height<length>2.5rem
--instui-component-base-button-small-height<length>2rem
--instui-elevation-abovenone | <shadow>#
--instui-icon-circle-check<image>url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%2F%3E%3Cpath%20d%3D%22m9%2012%202%202%204-4%22%2F%3E%3C%2Fsvg%3E')
--instui-icon-circle-x<image>url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%2F%3E%3Cpath%20d%3D%22m15%209-6%206%22%2F%3E%3Cpath%20d%3D%22m9%209%206%206%22%2F%3E%3C%2Fsvg%3E')
--instui-icon-info<image>url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%2F%3E%3Cpath%20d%3D%22M12%2016v-4%22%2F%3E%3Cpath%20d%3D%22M12%208h.01%22%2F%3E%3C%2Fsvg%3E')
--instui-icon-triangle-alert<image>url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m21.73%2018-8-14a2%202%200%200%200-3.48%200l-8%2014A2%202%200%200%200%204%2021h16a2%202%200%200%200%201.73-3%22%2F%3E%3Cpath%20d%3D%22M12%209v4%22%2F%3E%3Cpath%20d%3D%22M12%2017h.01%22%2F%3E%3C%2Fsvg%3E')
--instui-spacing-space-xs<length>0.25rem
--pantoken-glyph<url>url("data:image/svg+xml

하위 컴포넌트

관련 항목

  • close-button — 경고에 포함될 수 있는 해제 컨트롤입니다.