JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/scroller/2.0.3/js/dataTables.scroller.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/scroller/2.0.3/css/scroller.dataTables.min.css">
<div class="flex">
<div class="flex-col">
</div>
<div class="flex-col">
<table id="example" class="display nowrap" style="width:100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</table>
</div>
</div>
CSS
.flex {
display: flex;
}
.flex-col {
flex: 1;
}
/* START CUSTOM SCROLLBAR */
.dataTables_scrollBody::-webkit-scrollbar {
width: 11px;
}
.dataTables_scrollBody::-webkit-scrollbar-track {
background: #e9e9ea;
border-radius: 6px;
}
.dataTables_scrollBody::-webkit-scrollbar-thumb {
background-color: #D3D3D3;
border-radius: 6px;
}
.dataTables_scrollBody {
scrollbar-color: #D3D3D3 #e9e9ea;
scrollbar-width: thin
}
/* END CUSTOM SCROLLBAR */
JavaScript
$(document).ready(function() {
var data = [];
for (var i = 0; i < 50000; i++) {
data.push([i, i, i, i, i]);
}
$('#example').DataTable({
data: data,
deferRender: true,
scrollY: 200,
scrollCollapse: true,
scroller: true
});
});