Modal Basic
<!-- 触发按钮 -->
<button onclick="modal_basic.showModal()" class="px-6 py-3 bg-blue-600 text-white font-medium rounded-lg shadow hover:bg-blue-700 transition-colors">
Open Modal
</button>
<!-- 模态框 -->
<dialog id="modal_basic" class="modal rounded-lg shadow-xl">
<div class="modal-box w-11/12 max-w-md bg-white p-0 rounded-lg">
<!-- 标题区 -->
<div class="p-4 border-b border-gray-200">
<h3 class="text-lg font-bold text-gray-900">Modal Title</h3>
</div>
<!-- 内容区 -->
<div class="p-4">
<p class="py-4 text-gray-600">
This is a basic modal dialog component. It can be used to display important information or request user input.
</p>
</div>
<!-- 底部按钮区 -->
<div class="p-4 border-t border-gray-200 flex justify-end">
<form method="dialog">
<button class="px-4 py-2 bg-blue-600 text-white font-medium rounded-lg shadow hover:bg-blue-700 transition-colors">
Close
</button>
</form>
</div>
</div>
</dialog>
<style>
.modal {
max-height: 90vh;
}
.modal-box {
overflow-y: auto;
}
.modal-backdrop {
background-color: rgba(0, 0, 0, 0.3);
}
</style>
Copied to clipboard