Modal Fullwidth
<!-- 触发按钮 -->
<button onclick="modal_fullwidth.showModal()" class="px-6 py-3 bg-blue-600 text-white font-medium rounded-lg shadow hover:bg-blue-700 transition-colors">
Open Full-width Modal
</button>
<!-- 全宽模态框 -->
<dialog id="modal_fullwidth" class="modal rounded-lg shadow-xl">
<div class="modal-box w-11/12 max-w-5xl bg-white p-0 rounded-lg">
<!-- 标题区 -->
<div class="p-4 border-b border-gray-200">
<h3 class="text-lg font-bold text-gray-900">Full-width Modal</h3>
</div>
<!-- 内容区 -->
<div class="p-4">
<p class="py-4 text-gray-600">
This is a full-width modal with a custom width setting. It's perfect for displaying large amounts of content,
tables, or complex layouts that need more horizontal space.
</p>
<!-- 示例表格 -->
<div class="overflow-x-auto mt-4">
<table class="min-w-full border-collapse border border-gray-300">
<thead>
<tr class="bg-gray-100">
<th class="border border-gray-300 px-4 py-2 text-left">ID</th>
<th class="border border-gray-300 px-4 py-2 text-left">Name</th>
<th class="border border-gray-300 px-4 py-2 text-left">Email</th>
<th class="border border-gray-300 px-4 py-2 text-left">Department</th>
<th class="border border-gray-300 px-4 py-2 text-left">Position</th>
<th class="border border-gray-300 px-4 py-2 text-left">Status</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border border-gray-300 px-4 py-2">001</td>
<td class="border border-gray-300 px-4 py-2">John Doe</td>
<td class="border border-gray-300 px-4 py-2">[email protected]</td>
<td class="border border-gray-300 px-4 py-2">Marketing</td>
<td class="border border-gray-300 px-4 py-2">Manager</td>
<td class="border border-gray-300 px-4 py-2">Active</td>
</tr>
<tr class="bg-gray-50">
<td class="border border-gray-300 px-4 py-2">002</td>
<td class="border border-gray-300 px-4 py-2">Jane Smith</td>
<td class="border border-gray-300 px-4 py-2">[email protected]</td>
<td class="border border-gray-300 px-4 py-2">Sales</td>
<td class="border border-gray-300 px-4 py-2">Representative</td>
<td class="border border-gray-300 px-4 py-2">Active</td>
</tr>
<tr>
<td class="border border-gray-300 px-4 py-2">003</td>
<td class="border border-gray-300 px-4 py-2">Robert Johnson</td>
<td class="border border-gray-300 px-4 py-2">[email protected]</td>
<td class="border border-gray-300 px-4 py-2">IT</td>
<td class="border border-gray-300 px-4 py-2">Developer</td>
<td class="border border-gray-300 px-4 py-2">Active</td>
</tr>
</tbody>
</table>
</div>
</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