Modal Component
CSS-only Tailwind CSS modal using native <dialog>. Responsive sizing, backdrop, and focus trap. No JavaScript for basic usage. WCAG AA accessible, works with Django, HTMX, Laravel, React, and any stack.
Modal bileşenler, odaklanmış, yer paylaşımlı bir pencerede önemli bilgileri görüntüler veya kullanıcı eylemi ister. Anlamsal HTML diyalog öğeleri üzerine inşa edilen modlar, animasyonları, özelleştirilebilir konumlandırmayı ve arka plan kaplamalarını destekler. Frutjam modal sistemine klavye navigasyonu ve tuzak odağı ile tamamen erişilebilir olduğundan onaylar, formlar ve uyarı diyalogları için idealdir.
Yalnızca CSS, JavaScript gerekmez. WCAG AA erişilebilir ve çerçeveden bağımsız — Django, HTMX, Laravel, React ve tüm yığınlarla çalışır.
| Sınıf | Tip | Tanım |
|---|---|---|
| modal | Temel | Tam ekran iletişim kutusu yer paylaşımı kapsayıcısı |
| modal-content | Değiştirici | Dolgulu ve arka planlı iç panel |
| modal-backdrop | Değiştirici | Tıklayıp kapatılabilen arka plan kaplaması |
| modal-top | Değiştirici | İçeriği ekranın üst kısmına hizalar |
| modal-bottom | Değiştirici | İçeriği ekranın alt kısmına hizalar |
| modal-start | Değiştirici | İçeriği sola hizalar |
| modal-end | Değiştirici | İçeriği sağa hizalar |
| modal-center | Değiştirici | Yatay olarak ortalanmış |
| modal-middle | Değiştirici | Dikey olarak ortalanmış |
| modal-slide-up | Stil | Yukarı kaydırmalı giriş animasyonu |
| modal-slide-down | Stil | Aşağı kaydırmalı giriş animasyonu |
| modal-slide-start | Stil | Sol animasyondan içeri kaydırma |
| modal-slide-end | Stil | Sağ animasyondan içeri kaydırın |
Temel Kullanım
<dialog id="myModal"> HTML öğesine benzersiz bir kimlik ekleyin, ardından kipi açmak için myModal.showModal()'ı ve kipi kapatmak için myModal.close()'u çağırmak için JavaScript'te bu kimliği kullanın.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <dialog class="modal modal-center lg:modal-middle modal-slide-end lg:modal-slide-down" id="toggleModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Dialog modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="toggleModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Press Esc key or close button to close the modal</p> </div> <button type="button" class="modal-backdrop" onclick="toggleModal.close()">Close Modal via Backdrop</button> </dialog> <button type="button" class="btn btn-xs" onclick="toggleModal.showModal()">Show Modal</button> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import { useModal } from 'frutjam/react' export default function ModalDemo() { const modal = useModal() return ( <> <button type="button" className="btn btn-xs" onClick={modal.open}>Show Modal</button> <dialog ref={modal.ref} className="modal modal-center lg:modal-middle modal-slide-end lg:modal-slide-down"> <div className="modal-content"> <div className="flex justify-between items-center gap-3"> <div className="font-medium heading-lg">Dialog modal</div> <button type="button" className="btn btn-xs btn-square btn-rounded btn-ghost" onClick={modal.close}> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div className="divider my-3"></div> <p className="para">Press Esc key or close button to close the modal</p> </div> <button type="button" className="modal-backdrop" onClick={modal.close}>Close Modal via Backdrop</button> </dialog> </> ) } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <script setup> import { ref } from 'vue' const dialogRef = ref(null) </script> <template> <button type="button" class="btn btn-xs" @click="dialogRef.showModal()">Show Modal</button> <dialog ref="dialogRef" class="modal modal-center lg:modal-middle modal-slide-end lg:modal-slide-down"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Dialog modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" @click="dialogRef.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Press Esc key or close button to close the modal</p> </div> <button type="button" class="modal-backdrop" @click="dialogRef.close()">Close Modal via Backdrop</button> </dialog> </template> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <script> let dialog = $state(null) </script> <button type="button" class="btn btn-xs" onclick={() => dialog.showModal()}>Show Modal</button> <dialog bind:this={dialog} class="modal modal-center lg:modal-middle modal-slide-end lg:modal-slide-down"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Dialog modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick={() => dialog.close()}> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Press Esc key or close button to close the modal</p> </div> <button type="button" class="modal-backdrop" onclick={() => dialog.close()}>Close Modal via Backdrop</button> </dialog> |
Dışarıya tıkladığınızda modeli kapatın
.modal-backdrop, modal içeriğinin dışına tıklandığında kipi kapatan tıklanabilir bir arka plan sağlar.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <dialog class="modal" id="backdropModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Dialog modal</div> </div> <div class="divider my-3"></div> <p class="para">Press Esc key or click outside to close the modal</p> </div> <button type="button" class="modal-backdrop" onclick="backdropModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="backdropModal.showModal()">Show Modal</button> |
Modal Slayt Animasyonları
Aşağıdaki yön yardımcı program sınıflarıyla üstten, alttan, başlangıçtan (LTR'de sola, RTL'de sağa) veya sondan (LTR'de sağa, RTL'de sola) sorunsuz bir şekilde içeri ve dışarı kaydırın: modal bileşende modal-slide-top, modal-slide-bottom, modal-slide-start ve modal-slide-end. Bu animasyonlar, modal konuma dayalı dinamik geçişlerin kullanımı yoluyla kullanıcı deneyimini geliştirir.
Başlangıçtan itibaren modal slayt (Yatay)
Modeli başlangıç tarafından yatay olarak kaydırmak için modal-slide-start yardımcı programını ekleyin; soldan sağa (LTR) düzenlerde soldan, sağdan sola (RTL) düzenlerde ise sağdan görünür.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <dialog class="modal modal-center lg:modal-middle modal-slide-start" id="slideStartModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Slide start modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="slideStartModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Horizontally slides the modal in and out from the start side.</p> </div> </dialog> <button type="button" class="btn btn-xs" onclick="slideStartModal.showModal()">Show Modal</button> |
Uçtan modal slayt (Yatay)
Modal'ı uç taraftan yatay olarak kaydırmak için modal bileşenine modal-slide-end yardımcı programını ekleyin; soldan sağa (LTR) düzenlerde sağdan, sağdan sola (RTL) düzenlerde ise soldan görünür.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <dialog class="modal modal-center lg:modal-middle modal-slide-end" id="slideEndModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Slide end modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="slideEndModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Horizontally slides the modal in and out from the end side.</p> </div> </dialog> <button type="button" class="btn btn-xs" onclick="slideEndModal.showModal()">Show Modal</button> |
Alttan Kaydırma (Dikey): modal-slide-up
Yön: Alttan dikey olarak kayar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <dialog class="modal modal-center lg:modal-middle modal-slide-up" id="slideUpModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Slide up modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="slideUpModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Vertically slides the modal in and out from the bottom.</p> </div> </dialog> <button type="button" class="btn btn-xs" onclick="slideUpModal.showModal()">Show Modal</button> |
Üstten Kaydırma (Dikey)
Üstten dikey olarak kaydırmak için modal bileşene modal-slide-down yardımcı programını ekleyin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <dialog class="modal modal-center lg:modal-middle modal-slide-down" id="slideDownModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Slide down modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="slideDownModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Vertically slides the modal in and out from the top.</p> </div> </dialog> <button type="button" class="btn btn-xs" onclick="slideDownModal.showModal()">Show Modal</button> |
Bildirim için kayan animasyon modunun örnek kullanımı
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <dialog class="modal modal-end modal-top modal-slide-end" id="notificationSlideModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Notification modal</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="notificationSlideModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> </div> </dialog> <button type="button" class="btn btn-xs" onclick="notificationSlideModal.showModal()">Show Modal</button> |
Kalıcı yerleşimler
Modal bileşen varsayılan olarak ekranın ortasına konumlandırılır, ancak kullanım durumuna bağlı olarak yatay sınıflar modal-start, modal-center veya modal-end ve dikey sınıflar modal-top, modal-middle veya modal-bottom kullanılarak yerleştirilebilir. Yerleştirme, RTL ve LTR uyumluluğu göz önünde bulundurularak tasarlanmış olup, modun farklı dil yönlerine ve düzenlere uyarlanabilir olmasını sağlar.
Yatay yerleştirme için modal-start, modal-center veya modal-end'i ve dikey yerleştirme için modal-top, modal-middle veya modal-bottom'u kullanın. Bu sınıflar modal bileşene uygulanır.
Sol üst modal yerleşim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-start modal-top" id="topLeftModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement top left</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="topLeftModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the top left corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="topLeftModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="topLeftModal.showModal()">Show Modal</button> |
Üst orta modal yerleştirme
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-center modal-top" id="topCenterModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement top center</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="topCenterModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the top center corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="topCenterModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="topCenterModal.showModal()">Show Modal</button> |
Sağ üst modal yerleşim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-end modal-top" id="topEndModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement top end</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="topEndModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the top end corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="topEndModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="topEndModal.showModal()">Show Modal</button> |
Orta sol modal yerleştirme
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-start modal-middle" id="startCenterModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement left center</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="startCenterModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the start center corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="startCenterModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="startCenterModal.showModal()">Show Modal</button> |
Orta sağ modal yerleştirme
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-end modal-middle" id="endCenterModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement right center</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="endCenterModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the end center corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="endCenterModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="endCenterModal.showModal()">Show Modal</button> |
Sol alt modal yerleşim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-start modal-bottom" id="bottomStartModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement bottom start</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="bottomStartModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the bottom start corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="bottomStartModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="bottomStartModal.showModal()">Show Modal</button> |
Alt orta modal yerleştirme
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-center modal-bottom" id="bottomCenterModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement bottom center</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="bottomCenterModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the bottom center corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="bottomCenterModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="bottomCenterModal.showModal()">Show Modal</button> |
Sağ alt modal yerleşim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <dialog class="modal modal-end modal-bottom" id="bottomEndModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Modal placement bottom center</div> <button type="button" class="btn btn-xs btn-square btn-rounded btn-ghost" onclick="bottomEndModal.close()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M18 6 6 18"></path> <path d="m6 6 12 12"></path> </svg> </button> </div> <div class="divider my-3"></div> <p class="para">Modal placed at the bottom center corner of the screen</p> </div> <button type="button" class="modal-backdrop" onclick="bottomEndModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="bottomEndModal.showModal()">Show Modal</button> |
Modun masaüstü ve mobil ekranlar için duyarlı konumlandırılması
Kullanım durumunuza bağlı olarak, modeli masaüstünde veya mobilde herhangi bir yere (örneğin, masaüstü merkezi ve mobil üst orta) konumlandırabilirsiniz.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <dialog class="modal modal-center modal-top lg:modal-center lg:modal-middle" id="responsiveModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Responsive modal</div> </div> <div class="divider my-3"></div> <p class="para">Resize the modal to a small screen to see the change in modal position.</p> </div> <button type="button" class="modal-backdrop" onclick="responsiveModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="responsiveModal.showModal()">Show Modal</button> |
Dil yönüne dayalı modal konumlandırma
Dil yönüne (LTR veya RTL) bağlı olarak kipi ekranın herhangi bir yerine yerleştirin.
LTR ve RTL'de sağa hizalanmış ve dikey olarak ortalanmış
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <dialog class="modal ltr:modal-end ltr:modal-middle rtl:modal-start lg:modal-middle" id="ltrModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Responsive modal</div> </div> <div class="divider my-3"></div> <p class="para"> Changing <code>dir="rtl"</code> in the HTML will have no effect on the modal's the position because the layout is controlled by utility classes: <code>modal-end</code> for the LTR variant and <code>modal-start</code> for the RTL variant. </p> </div> <button type="button" class="modal-backdrop" onclick="ltrModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="ltrModal.showModal()">Show Modal</button> |
Modal'ı ekran boyutuna ve dil yönüne göre yerleştirin
1 2 3 4 5 6 7 8 9 10 11 12 13 | <dialog class="modal ltr:modal-center lg:ltr:modal-start ltr:modal-top lg:ltr:modal-middle rtl:modal-center lg:rtl:modal-start rtl:modal-bottom lg:rtl:modal-middle" id="mixedModal"> <div class="modal-content"> <div class="flex justify-between items-center gap-3"> <div class="font-medium heading-lg">Responsive modal</div> </div> <div class="divider my-3"></div> <p class="para">Change the screen and screen direction to see the change in modal position.</p> </div> <button type="button" class="modal-backdrop" onclick="mixedModal.close()"> Close Modal via Backdrop </button> </dialog> <button type="button" class="btn btn-xs" onclick="mixedModal.showModal()">Show Modal</button> |