Naye tools shamil kiye gaye! Dekhein kya naya hai

Home/Components/Zamarah/Overlays

Overlays

Accessible Tailwind CSS overlay components: native dialog element par banaye gaye modal dialogs, drawers, tooltips aur popovers. HTML aur React code.

Overlays kisi decision ko lene ya extra detail dikhane ke liye page ke upar nazar aate hain: modals, drawers, tooltips aur popovers. Yeh powerful hote hain lekin inhein sahi se set karna mushkil hota hai, kyun ke focus, scrolling aur screen reader behavior sab ko ek sath kaam karna hota hai.

Yahan modal browser ke native dialog element par banaya gaya hai, is liye focus trapping, backdrop, close karne ke liye Escape key aur inert background browser platform se hi mil jate hain, bajaye iske ke aapko custom JavaScript maintain karni pare.

Aap in overlay components ke sath kya kar sakte hain

Modal dialogs

Destructive actions ko confirm karein, ek chota form collect karein ya kisi decision ki zaroorat ho, jab dialog close ho toh focus waapas trigger par chala jata hai.

Drawers, tooltips aur popovers

Users ko kisi doosre page par bheje bagair extra panels slide-in karein ya context ki choti details dikhain.

Platform behavior

showModal ke sath open karne se focus trap ho jata hai, peeche wala page inert ho jata hai aur Escape key handle ho jati hai, bina kisi extra attributes ko sync mein rakhe.

In overlay components ko kyun istemal karein

  • Maintain karne ke liye kam code, kyun ke browser focus aur backdrop ko khud handle karta hai.
  • aria-labelledby aur aria-describedby ke sath label kiya gaya hai taake dialogs ek naam ke sath announce hon.
  • Install ya update karne ke liye koi dialog library nahi.

Overlay components: aksar pooche jane wale sawalat

div ke bajaye native dialog element kyun istemal karein?

Yeh focus trapping, focus restoration, ek backdrop, Escape handling aur ek inert background free mein provide karta hai. Yeh woh parts hain jo hand-built modals mein aksar ghalat ho jate hain.

Mujhe modal kab istemal karna chahiye?

Sirf tabhi jab kisi decision ke bagair aage barhna ghalat ho, jaise deletion ko confirm karna. Kisi bhi aisi cheez ke liye jise interrupt karne ki zaroorat nahi hai, page, panel ya toast ka istemal karein.

Backdrop par click karne se kabhi kabhar dialog close kyun nahi hota?

Aksar is wajah se hota hai kyun ke padding khud dialog element par set ki gayi hoti hai. Padding ko inner container par rakhein taake backdrop click check reliable rahe.