Skip to content

CSS: alert

.instui-alert · stable — एक इनलाइन संदेश जिसमें एक स्थिति रंग पट्टी और साझा आइकन सेट से मास्क किया हुआ स्थिति प्रतीक है।

एक कस्टम -icon-<name> स्थिति प्रतीक को बदलता है लेकिन वेरिएंट की रंगीन पट्टी को बनाए रखता है; बार भराव को उच्च विशिष्टता पर फिर से लागू किया जाता है ताकि साझा आइकन पेंटर इसे ग्रहण न करे। एक प्रत्यक्ष क्लोज बटन डिफ़ॉल्ट रूप से छोटा होता है; ओवरराइड करने के लिए एक साइज मॉडिफायर जोड़ें।

Source: alert.css

TIP

JS संवर्धन — यह कंपोनेंट का CSS स्वयं रेंडर और कार्य करता है; इंटरैक्टिव व्यवहार जोड़ने के लिए इसे @pantoken/interactions के साथ पेयर करें। इसका -timeout मॉडिफायर उस व्यवहार द्वारा संचालित होता है। नीचे के modifier table को देखें।

एक्सेसिबिलिटी

एक महत्वपूर्ण संदेश के लिए, role="alert" या एक aria-live क्षेत्र जोड़ें ताकि सहायक तकनीक इसे घोषीत करे; dismiss नियंत्रण एक लेबल किया हुआ क्लोज बटन है (उदाहरण में .instui-close-button में aria-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अलर्ट का संदेश सामग्री; इसमें एक dismiss बटन शामिल हो सकता है।

मॉडिफायर

मॉडिफायरविवरण
.-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स्वचालितDismissal से एक सेकंड पहले।
.-timeout-2स्वचालितDismissal से दो सेकंड पहले।
.-timeout-3स्वचालितDismissal से तीन सेकंड पहले।
.-timeout-4स्वचालितDismissal से चार सेकंड पहले।
.-timeout-5स्वचालितDismissal से पांच सेकंड पहले।
.-variant-errorअप्रमाणित — use .-color-danger.
.-variant-infoअप्रमाणित — use .-color-info.
.-variant-successअप्रमाणित — use .-color-success.
.-variant-warningअप्रमाणित — use .-color-warning.
.-without-shadowडिफ़ॉल्ट elevation छाया हटाएँ (InstUI hasShadow={false})।

स्यूडो-एलिमेंट्स

स्यूडो-एलिमेंटविवरण
::afterसफेद स्थिति प्रतीक, मास्क किया हुआ और बार के ऊपर केन्द्रित।
::beforeठोस वेरिएंट-रंगीन स्थिति बार, गोल प्रारंभिक किनारे के साथ मिलती हुई।

कस्टम प्रॉपर्टीज

प्रॉपर्टीप्रकारडिफ़ॉल्टविवरण
--pantoken-alert-glyph<url>निम्न-स्तरीय स्थिति-प्रतिभू प्रतीक स्रोत; -icon-<name> इसे आपके लिए सेट करता है। कस्टम आइकन के लिए ओवरराइड करें (एक URL-एन्कोडेड SVG)।
--pantoken-alert-icon-bg<color>ग्लिफ के पीछे रंगीन स्थिति-बार भराव; हर -color-* वेरिएंट अपना सेट करता है।
--timeout<integer>स्वचालितDismissal से पहले मिलीसेकंड; 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 — वह dismiss नियंत्रण जो एक अलर्ट शामिल कर सकता है।