דילוג לתוכן
uiify

Modal

תיבת דו-שיח מודאלית המבוססת על אלמנט הדו-שיח המובנה.

דפדפנים
Chrome 123+Firefox 121+Safari 17.5+
שכבה
0
גודל חבילה דחוסה
875 B
מגבלת פריסה כפויה
0 ms
מגבלת Axe
0
תואם SSR
כן
מבוסס על
elements/dialog
חוזה מפורסם
סביבת בדיקות

מגרש ניסויים

Small

24rem wide.

Large

40rem wide.

Terms of service

The whole document scrolls together.

Clause 1: text that makes the document taller than the screen.

Clause 2: text that makes the document taller than the screen.

Clause 3: text that makes the document taller than the screen.

Clause 4: text that makes the document taller than the screen.

Clause 5: text that makes the document taller than the screen.

Clause 6: text that makes the document taller than the screen.

Clause 7: text that makes the document taller than the screen.

Clause 8: text that makes the document taller than the screen.

Clause 9: text that makes the document taller than the screen.

Clause 10: text that makes the document taller than the screen.

Clause 11: text that makes the document taller than the screen.

Clause 12: text that makes the document taller than the screen.

Clause 13: text that makes the document taller than the screen.

Clause 14: text that makes the document taller than the screen.

Clause 15: text that makes the document taller than the screen.

Clause 16: text that makes the document taller than the screen.

Clause 17: text that makes the document taller than the screen.

Clause 18: text that makes the document taller than the screen.

Clause 19: text that makes the document taller than the screen.

Clause 20: text that makes the document taller than the screen.

Clause 21: text that makes the document taller than the screen.

Clause 22: text that makes the document taller than the screen.

Clause 23: text that makes the document taller than the screen.

Clause 24: text that makes the document taller than the screen.

Clause 25: text that makes the document taller than the screen.

Clause 26: text that makes the document taller than the screen.

Clause 27: text that makes the document taller than the screen.

Clause 28: text that makes the document taller than the screen.

Clause 29: text that makes the document taller than the screen.

Clause 30: text that makes the document taller than the screen.

Edit profile

Unsaved changes are lost when you close.

Discard changes?

This cannot be undone.

הגדרות

עדכון העדפות הפרופיל שלך.

API

Modal

ModalTrigger

מאפייןטיפוסברירת מחדלתיאור
target*string—מזהה ה-ModalContent שכפתור זה פותח; הדפדפן מאתר אותו בזמן הלחיצה, ולכן לא מופעל JavaScript שלנו.
childrenReactNode—תוכן כפתור הפתיחה.
asTAs & NativeButtonAs<TAs>"button"רכיב המעביר מאפיינים ו-ref לכפתור מובנה; תגיות אחרות נדחות, כי פקודות הפעלה דורשות כפתור אמיתי.

ModalContent

מאפייןטיפוסברירת מחדלתיאור
id*string—מזהה ייחודי שמספק המשתמש בספרייה; כפתור הפתיחה ויעד הסגירה מפנים אליו.
size"sm" | "md" | "lg" | "full""md"מדרגת רוחב (24, 28, 40rem). הערך full ממלא את אזור התצוגה. נכתב ל-data-size; לרוחב מותאם אישית יש לדרוס את --uiify-modal-inline-size.
align"center" | "start""center"מיקום אנכי בטאבלט ובמחשב. בטלפונים מוצג לוח תחתון אלא אם size הוא full.
dismiss"any" | "closerequest" | "none""any"closedby: הערך any מוסיף לחיצות על הרקע, closerequest מאפשר רק Escape, ו-none רק את הפקדים שלכם. Safari אינו תומך ב-closedby, ולכן Escape תמיד סוגר; UIEnhance מטפל בלחיצות על הרקע (any) ובהחלקת הלוח (כשאינו none).
backdrop"opaque" | "blur" | "none""opaque"מראה הרקע. נכתב ל-data-backdrop.
childrenReactNode—תוכן תיבת הדו-שיח.

ModalClose

מאפייןטיפוסברירת מחדלתיאור
target*string—מזהה ה-ModalContent שכפתור זה סוגר.
childrenReactNode—תוכן כפתור הסגירה.
asTAs & NativeButtonAs<TAs>"button"רכיב המעביר מאפיינים ו-ref לכפתור מובנה; תגיות אחרות נדחות, כי פקודות הפעלה דורשות כפתור אמיתי.

ModalHeader

מאפייןטיפוסברירת מחדלתיאור
childrenReactNode—שורה עליונה מקובעת המכילה את הכותרת, התיאור ופקד הסגירה.

ModalTitle

מאפייןטיפוסברירת מחדלתיאור
childrenReactNode—השם הנגיש של תיבת הדו-שיח; יש להפנות למזהה שלו מ-aria-labelledby.

ModalDescription

מאפייןטיפוסברירת מחדלתיאור
childrenReactNode—טקסט משלים; יש להפנות למזהה שלו מ-aria-describedby.

ModalBody

מאפייןטיפוסברירת מחדלתיאור
childrenReactNode—אזור הגלילה בין הכותרת העליונה לתחתית.

ModalFooter

מאפייןטיפוסברירת מחדלתיאור
childrenReactNode—שורת פעולות המקובעת מתחת לגוף.

ModalGrabber

מאפייןטיפוסברירת מחדלתיאור
childrenReactNode—ידית גרירה דקורטיבית בלוח הנייד; ההחלקה מתחילה כאן.

ModalClientContent (@gunkin/uiify/components/modal/client)

מאפייןטיפוסברירת מחדלתיאור
id*string—מזהה ייחודי שמספק המשתמש בספרייה; חלקי הפתיחה והסגירה מפנים אליו.
openboolean—מצב פתיחה מבוקר, הקובע לאחר ההידרציה.
defaultOpenboolean—מצב התחלתי לא מבוקר, המוחל באמצעות showModal() לאחר ההידרציה; ה-HTML מהשרת נשאר סגור.
onOpenChange(open: boolean) => void—מופעלת פעם אחת לכל שינוי מובנה או מתוכנת עם המצב החדש, לרבות פעם אחת בעת הטעינה אם הדפדפן פתח את התיבה לפני ההידרציה.
onOpenChangeComplete(open: boolean) => void—מופעלת פעם אחת לכל מעבר פתיחה או סגירה לאחר סיום מעברי ה-CSS שלו, או מיד אם אין מעברים, לרבות מעבר defaultOpen לאחר ההידרציה; לעולם לא כשתיבת הדו-שיח נשארת ללא שינוי.
size"sm" | "md" | "lg" | "full""md"מדרגת רוחב (24, 28, 40rem). הערך full ממלא את אזור התצוגה. נכתב ל-data-size; לרוחב מותאם אישית יש לדרוס את --uiify-modal-inline-size.
align"center" | "start""center"מיקום אנכי בטאבלט ובמחשב. בטלפונים מוצג לוח תחתון אלא אם size הוא full.
dismiss"any" | "closerequest" | "none""any"closedby: הערך any מוסיף לחיצות על הרקע, closerequest מאפשר רק Escape, ו-none רק את הפקדים שלכם. Safari אינו תומך ב-closedby, ולכן Escape תמיד סוגר; UIEnhance מטפל בלחיצות על הרקע (any) ובהחלקת הלוח (כשאינו none).
backdrop"opaque" | "blur" | "none""opaque"מראה הרקע. נכתב ל-data-backdrop.
childrenReactNode—תוכן תיבת הדו-שיח.

מקלדת

מקשפעולה
Escapeסגירה (רק המודאל העליון במקרה של קינון)
Tabמעבר מחזורי של המיקוד בתוך המודאל
Shift+Tabסדר Tab הפוך

נגישות

אלמנט <dialog> מובנה שנפתח באמצעות מפעיל עם command="show-modal" לפני הרצת JavaScript כלשהו. הדפדפן אחראי למודאליות, לכליאת המיקוד, ל-Escape ולהחזרת המיקוד; הסגירה משתמשת ב-request-close כך ש-onCancel יכול למנוע אותה. סמל הסגירה בכותרת תמיד קיים. בטלפונים המודאל הוא יריעה תחתונה; החלקה כלפי מטה והקשה על הרקע הן קיצורי דרך, ולעולם אינן הדרך היחידה לצאת.

נקודות חיבור לעיצוב

data-uiify-modaldata-part="trigger|content|header|title|description|body|footer|grabber|close"data-size="sm|lg|full"data-align="start"data-backdrop="blur|none"--uiify-trigger-open (inside [data-uiify-modal][data-part="root"])--uiify-modal-inline-size (dialog width)
דף זה תורגם אוטומטית וטרם נבדק.