MediaWiki:CustomDatatable.css

From The Seven Sages of Rome
Revision as of 10:22, 13 January 2026 by Noeth (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Modern ShadCN DataTable Styling */

/* Base table styles */
.dataTables_wrapper {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: hsl(222.2 47.4% 11.2%);
  font-size: 14px;
}

.dataTables_wrapper table.dataTable {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 8px;
  overflow: hidden;
}

/* Header styling */
.dataTables_wrapper table.dataTable thead {
  background-color: hsl(210 40% 98%);
  border-bottom: 1px solid hsl(214.3 31.8% 91.4%);
}

.dataTables_wrapper table.dataTable thead th {
  padding: 12px 16px;
  font-weight: 500;
  text-align: left;
  font-size: 13px;
  color: hsl(215.4 16.3% 46.9%);
  border-bottom: 1px solid hsl(214.3 31.8% 91.4%);
  background-color: hsl(210 40% 98%);
  white-space: nowrap;
}

/* Sortable columns */
.dataTables_wrapper table.dataTable thead th.sorting,
.dataTables_wrapper table.dataTable thead th.sorting_asc,
.dataTables_wrapper table.dataTable thead th.sorting_desc {
  cursor: pointer;
  position: relative;
  padding-right: 30px;
}

.dataTables_wrapper table.dataTable thead th.sorting:after,
.dataTables_wrapper table.dataTable thead th.sorting_asc:after,
.dataTables_wrapper table.dataTable thead th.sorting_desc:after {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  font-size: 12px;
}

.dataTables_wrapper table.dataTable thead th.sorting:after {
  content: "⇅";
}

.dataTables_wrapper table.dataTable thead th.sorting_asc:after {
  content: "↑";
  opacity: 1;
}

.dataTables_wrapper table.dataTable thead th.sorting_desc:after {
  content: "↓";
  opacity: 1;
}

/* Body rows */
.dataTables_wrapper table.dataTable tbody tr {
  border-bottom: 1px solid hsl(214.3 31.8% 91.4%);
  transition: background-color 0.15s ease;
}

.dataTables_wrapper table.dataTable tbody tr:hover {
  background-color: hsl(210 40% 98%);
}

.dataTables_wrapper table.dataTable tbody tr:last-child {
  border-bottom: none;
}

.dataTables_wrapper table.dataTable tbody td {
  padding: 16px;
  vertical-align: middle;
  color: hsl(222.2 47.4% 11.2%);
}

/* Selected rows */
.dataTables_wrapper table.dataTable tbody tr.selected {
  background-color: hsl(210 40% 96.1%);
}

/* Checkboxes */
.dataTables_wrapper table.dataTable input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 4px;
  cursor: pointer;
  accent-color: hsl(222.2 47.4% 11.2%);
}

/* Badge styling for tags */
.dataTables_wrapper .badge,
.dataTables_wrapper .tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  background-color: hsl(210 40% 96.1%);
  color: hsl(222.2 47.4% 11.2%);
  border: 1px solid hsl(214.3 31.8% 91.4%);
}

/* Status indicators */
.dataTables_wrapper .status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: hsl(215.4 16.3% 46.9%);
  font-size: 14px;
}

.dataTables_wrapper .status-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* Priority indicators */
.dataTables_wrapper .priority {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: hsl(215.4 16.3% 46.9%);
}

.dataTables_wrapper .priority-arrow {
  font-size: 16px;
  line-height: 1;
}

/* DataTables controls wrapper */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  padding: 16px 0;
  color: hsl(215.4 16.3% 46.9%);
}

/* Search/filter input */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  margin-left: 8px;
  outline: none;
  transition: border-color 0.15s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: hsl(222.2 47.4% 11.2%);
  box-shadow: 0 0 0 2px hsl(222.2 47.4% 11.2% / 0.1);
}

/* Length selector */
.dataTables_wrapper .dataTables_length select {
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 6px;
  padding: 8px 32px 8px 12px;
  font-size: 14px;
  margin: 0 8px;
  outline: none;
  background-color: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0 2px;
  font-size: 14px;
  background-color: white;
  color: hsl(222.2 47.4% 11.2%);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-block;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: hsl(210 40% 96.1%);
  border-color: hsl(214.3 31.8% 85%);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: hsl(222.2 47.4% 11.2%);
  color: white;
  border-color: hsl(222.2 47.4% 11.2%);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
  font-size: 14px;
  color: hsl(215.4 16.3% 46.9%);
}

/* Processing indicator */
.dataTables_wrapper .dataTables_processing {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 8px;
  padding: 16px 24px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* Empty state */
.dataTables_wrapper .dataTables_empty {
  text-align: center;
  padding: 48px 16px !important;
  color: hsl(215.4 16.3% 46.9%);
  font-size: 14px;
}

/* Toolbar buttons (if you add action buttons) */
.dataTables_wrapper .dt-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.dataTables_wrapper .dt-button {
  border: 1px solid hsl(214.3 31.8% 91.4%);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  background-color: white;
  color: hsl(222.2 47.4% 11.2%);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dataTables_wrapper .dt-button:hover {
  background-color: hsl(210 40% 96.1%);
  border-color: hsl(214.3 31.8% 85%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    text-align: left;
    margin-bottom: 16px;
  }
  
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    text-align: center;
    justify-content: center;
  }
}

/* Scrolling table on mobile */
.dataTables_wrapper .dataTables_scroll {
  overflow-x: auto;
}

/* Three-dot menu button (add to your HTML if needed) */
.dataTables_wrapper .action-menu {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  font-size: 18px;
  color: hsl(215.4 16.3% 46.9%);
}

.dataTables_wrapper .action-menu:hover {
  background-color: hsl(210 40% 96.1%);
}