Skip to content

CSS: alert

.instui-alert · stable — Yon mesaj an liy ak yon ba koulè estati ak yon glif estati kache soti nan seri ikon pataje a.

Yon -icon-<name> pèsonalize ranplase glif estati a men kenbe ba koulè varyan an; ranpli ba a re-afime ak yon espesifikite pi wo pou pent la ikon pataje pa konsome li. Yon bouton fèmen dirèk default sou ti; ajoute yon modifikatè gwosè pou ranplase li.

Source: alert.css

TIP

Amelyorasyon JS — CSS konpozan sa a rann li ak fonksyone pou kont li; pè li ak @pantoken/interactions pou ajoute konpòtman entèraktif la. Modifikatè -timeout li a kondwi pa konpòtman sa a. Gade tab modifikatè anba a.

Aksè

Pou yon mesaj enpòtan, ajoute role="alert" oswa yon zòn aria-live pou teknoloji asistans yo anonse li; kontwòl fèmen an se yon bouton fèmen ki gen etikèt (egzanp nan .instui-close-button pote aria-label="Close").

Itilizasyon

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

Egzanp

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>

Estrikti

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;

Espas

EspasDeskripsyon
contentKontni mesaj alam la; ka gen ladan yon bouton pou fèmen li.

Modifikatè

ModifikatèDeskripsyon
.-color-dangerYon mesaj erè.
.-color-infoEnfòmasyon (default).
.-color-successYon mesaj pozitif/konfimasyon.
.-color-warningYon mesaj avètisman.
.-has-shadow-falseAlias — maps to .-without-shadow.
.-icon-*Ranplase glif estati a ak yon ikon pèsonalize (egzanp -icon-megaphone), ki rete blan sou ba koulè varyan an.
.-render-custom-icon-*Depreke — The former renderCustomIcon prop; still works as an alias, but use -icon-<name> (or override --pantoken-alert-glyph) instead.
.-screen-reader-onlyVizyèlman kache men anonse.
.-timeoutInteraction — The alert will automatically dismiss after a default of 5 seconds.
.-timeout-1Yonn segonn anvan fèmen otomatik.
.-timeout-2De segonn anvan fèmen otomatik.
.-timeout-3Twa segonn anvan fèmen otomatik.
.-timeout-4Katre segonn anvan fèmen otomatik.
.-timeout-5Senki segonn anvan fèmen otomatik.
.-variant-errorDepreke — use .-color-danger.
.-variant-infoDepreke — use .-color-info.
.-variant-successDepreke — use .-color-success.
.-variant-warningDepreke — use .-color-warning.
.-without-shadowRetire lonbraj elevasyon default la (InstUI hasShadow={false}).

Pseudo-eleman

Pseudo-elemanDeskripsyon
::afterGlif estati blan an, kache epi santre sou ba a.
::beforeBa estati solid ki gen koulè varyan an, aliye ak kwen won kòmanse a.

Pwopriyete koutim

PwopriyeteTipPa defoDeskripsyon
--pantoken-alert-glyph<url>Sous glif estati ba nivo ki ba a; -icon-<name> mete li pou ou. Ranplase li pou yon ikon pèsonalize (yon SVG kòd-url).
--pantoken-alert-icon-bg<color>Ranpli ba estati ki gen koulè dèyè glif la; chak varyan -color-* fikse pa li menm.
--timeout<integer>Milyèm segonn anvan fèmen otomatik; 0 dezaktive li. Mande pake entèraksyon alam la.

Tokens konsome

TokenTipValè
--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

Sou-konpozan

Ki gen rapò