CSS Classes Reference
A complete catalog of the tc- prefixed CSS classes that the TableCrafter renderer emits for tables, responsive cards, filter/pagination/export controls, inline editing, and accessibility states, so you can target them from your theme stylesheet without touching plugin code.
How TableCrafter emits markup
TableCrafter renders in two layers. The server-side shortcode handler in tablecrafter.php prints an outer container plus a JSON config blob; the browser bundle assets/js/tablecrafter.js then mounts inside that container and builds the table, cards, and all interactive controls dynamically. Every visible element gets a stable tc- class, so the safest place to add custom CSS is your theme rather than overriding the plugin's assets/css/tablecrafter.css.
A minimal shortcode produces the outer container:
// Placed by the [tablecrafter] shortcode in tablecrafter.php
<div id="my-table" class="tablecrafter-container">
<script type="application/json" class="tc-initial-data">...</script>
</div>
After hydration, the JavaScript renderer injects a .tc-wrapper inside that container and fills it with either a table or a card grid.
The server container is .tablecrafter-container (with your shortcode id as the element id). The JS-rendered root inside it is .tc-wrapper. Scope custom rules to .tablecrafter-container .tc-wrapper when you want to avoid clashing with other tables on the page.
Top-level structure classes
These classes form the skeleton the renderer always produces. On desktop it builds a table; in responsive mobile mode it builds cards instead, swapping the inner block while keeping the same .tc-wrapper parent.
| Class | Element | Purpose |
|---|---|---|
| tablecrafter-container | Outer div (server) | Shortcode wrapper printed by PHP; carries your id attribute. |
| tc-initial-data | script type="application/json" | Holds the table config and seed data the JS reads on mount. |
| tc-wrapper | div | JS-rendered root. Also where tc-high-contrast / tc-reduced-motion modifiers are added. |
| tc-table-container | div | Scroll/overflow box around the table (horizontal scroll, border, radius). |
| tc-table | table | The data table itself. |
| tc-cards-container | div | Grid wrapper that replaces the table in responsive mobile mode. |
| tc-loading | div | Applied while data loads; pairs with skeleton rows. |
| tc-no-results | td / div | Empty-state message when filters return nothing. |
Table and header classes
Within .tc-table, sortable column headers receive tc-sortable. The current sort direction is expressed through the standard aria-sort attribute, not a separate class, and the stylesheet draws the arrow indicator from that attribute.
| Class / attribute | Element | Purpose |
|---|---|---|
| tc-sortable | th | Marks a clickable, sortable header. Shows a neutral ⇅ glyph by default. |
| aria-sort="ascending" | th | Active ascending sort. Styled with .tc-sortable[aria-sort="ascending"]::after to show ↑. |
| aria-sort="descending" | th | Active descending sort, rendered as ↓. |
| tc-editable | td / .tc-card-value | Cell that supports inline editing; gets hover affordances. |
| tc-skeleton-row | tr | Placeholder row shown during loading. |
| tc-skeleton-cell / tc-skeleton | td / span | Shimmer cells inside skeleton rows. |
To restyle sort arrows, target the attribute selectors rather than adding a class. For example: .tc-table th.tc-sortable[aria-sort="ascending"]::after. The renderer keeps aria-sort in sync with the active column automatically.
Cell value helper classes
When a column has a recognized value type, the renderer wraps the value in a typed element so you can style booleans, links, images, and tags consistently. These are emitted by the cell formatter in tablecrafter.js.
| Class | Element | Used for |
|---|---|---|
| tc-badge | span | Base badge for boolean / status values. |
| tc-badge-success | span | Truthy / "Yes" badge variant. |
| tc-badge-error | span | Falsy / "No" badge variant. |
| tc-link | a | Email (mailto:) and URL cell values. |
| tc-cell-image | img | Image-URL cells (lazy-loaded thumbnail). |
| tc-tag-list | div | Container for multi-value tag cells. |
| tc-tag | span | A single tag chip. |
| tc-more | span | Overflow chip, e.g. "+3 more". |
Card (responsive) classes
In mobile / responsive mode the renderer swaps the table for a card grid. Cards can collapse secondary fields behind an expand toggle. The classes below are produced by the card builder.
| Class | Element | Purpose |
|---|---|---|
| tc-card | div | One record rendered as a card. |
| tc-card-expandable | div | Modifier on cards that hide extra fields. |
| tc-card-expanded | div | State class added when a card is open. |
| tc-card-header | div | Card title row. |
| tc-card-toggle | span | Expand/collapse chevron (rotates when expanded). |
| tc-card-body | div | Grid of visible fields. |
| tc-card-field | div | One label/value pair. |
| tc-card-label | div | Field name (uppercased, muted). |
| tc-card-value | div | Field value; combines with tc-editable when editable. |
| tc-card-hidden-fields | div | Secondary fields revealed on expand. |
| tc-card-checkbox / tc-row-checkbox | input | Selection checkbox for bulk actions. |
| tc-card-quick-actions / tc-quick-action-btn | div / button | Per-card action menu. |
Controls: filters, search, and pagination
Above and below the data, TableCrafter renders a filter bar, optional global search, and pagination. Each filter type adds its own sub-classes, so you can style date-range and number-range filters independently from plain select/text filters.
| Class | Element | Purpose |
|---|---|---|
| tc-filters | div | Filter region wrapper. |
| tc-filters-row | div | Row holding individual filters. |
| tc-filter | div | A single filter control group. |
| tc-filter-label / tc-filter-input | label / input | Filter label and its input. |
| tc-global-search-container / tc-global-search | div / input | Cross-column search box. |
| tc-clear-filters | button | Reset-all-filters button. |
| tc-multiselect-button / tc-multiselect-dropdown / tc-multiselect-option | button / div | Multi-value dropdown filter parts. |
| tc-daterange-container / tc-date-from / tc-date-to | div / input | Date-range filter inputs. |
| tc-numberrange-container / tc-number-min / tc-number-max | div / input | Number-range filter inputs. |
| tc-pagination | div | Pagination region. |
| tc-pagination-info | div | "Showing X of Y" text. |
| tc-pagination-controls | div | Button group container. |
| tc-first-btn / tc-prev-btn / tc-next-btn / tc-last-btn | button | Page navigation buttons. |
| tc-page-jump / tc-page-input / tc-current-page / tc-total-pages | div / input / span | Jump-to-page control. |
| tc-page-size-controls / tc-page-size-label / tc-page-size-select | div / label / select | Rows-per-page selector. |
Export and bulk-action controls
When export is enabled, the renderer adds an export menu; the export handler (includes/class-tc-export-handler.php) backs CSV, XLSX, and PDF output, while these classes style the front-end trigger. Bulk operations add their own toolbar.
| Class | Element | Purpose |
|---|---|---|
| tc-export-controls | div | Export region wrapper. |
| tc-export-main-btn / tc-export-dropdown / tc-export-option | button / div | Export menu trigger and format options. |
| tc-export-csv / tc-copy-clipboard | button | Direct CSV download and copy-to-clipboard actions. |
| tc-export-icon / tc-export-title / tc-export-desc | span / div | Per-format option layout. |
| tc-bulk-controls / tc-bulk-actions / tc-bulk-info | div | Bulk toolbar, button group, and selection count. |
| tc-bulk-select-all | input | Select-all checkbox. |
| tc-bulk-edit / tc-bulk-delete / tc-bulk-export | button | Bulk operation buttons. |
State, feedback, and editing classes
Transient UI states use dedicated classes you can hook into, for example to brand the error retry button or the toast notifications.
| Class | Purpose |
|---|---|
| tc-loading-container | Loading panel wrapper. |
| tc-error / tc-error-container / tc-error-message | Error state and its message. |
| tc-retry-button | Retry button shown on fetch failure. |
| tc-toast / tc-toast-success / tc-toast-error | Transient notification toasts (type suffix appended). |
| tc-modal / tc-modal-overlay / tc-modal-header / tc-modal-title / tc-modal-form / tc-modal-actions / tc-modal-close | Add/edit record modal parts. |
| tc-edit-input / tc-edit-select / tc-edit-textarea / tc-edit-checkbox / tc-edit-color / tc-edit-file / tc-edit-radio / tc-edit-range | Inline edit widgets per field type. |
| tc-validation-error / tc-validation-message / tc-field-error / tc-field-valid | Inline validation feedback. |
| tc-refresh-toggle / tc-refresh-manual / tc-refresh-indicator / tc-refresh-status / tc-last-updated | Auto-refresh controls and status. |
Theming with CSS variables and accessibility classes
TableCrafter does not expose a global palette of CSS custom properties for normal rendering; the default look is set with hard-coded values in assets/css/tablecrafter.css. The custom properties that do exist are defined inside the high-contrast accessibility mode, and the renderer toggles accessibility modifier classes on .tc-wrapper based on the user's OS preferences (prefers-contrast, prefers-reduced-motion).
| Class / variable | Scope | Effect |
|---|---|---|
| tc-high-contrast | Modifier on .tc-wrapper | Activates the high-contrast theme and defines the variables below. |
| --tc-border-color | Within .tc-high-contrast | Table border color (default #000000). |
| --tc-text-color | Within .tc-high-contrast | Cell text color. |
| --tc-bg-color | Within .tc-high-contrast | Cell background color. |
| --tc-focus-color | Within .tc-high-contrast | Focus outline color (default #ff0000). |
| tc-reduced-motion | Modifier on .tc-wrapper | Collapses animations/transitions to near-zero duration. |
| tc-focused | Element state | Keyboard-focus marker used for high-contrast outlines. |
| tc-sr-only | Utility | Visually hidden, screen-reader-only text. |
Because the high-contrast variables are scoped to .tc-high-contrast, you can override them per table to recolor that mode:
/* Recolor TableCrafter's high-contrast mode in your theme */
.tc-wrapper.tc-high-contrast {
--tc-border-color: #222;
--tc-focus-color: #0a58ca;
}
/* Brand the default table header without editing the plugin */
.tablecrafter-container .tc-table th {
background-color: #0f172a;
color: #fff;
}
Several plugin rules use !important (notably the high-contrast and reduced-motion blocks). If an override does not take effect, raise specificity (e.g. prefix with .tablecrafter-container) or match the !important declaration. Avoid editing assets/css/tablecrafter.css directly, since plugin updates overwrite it.
Putting it together
A typical styling workflow: drop a table on a page, find its container, then scope rules to it.
[tablecrafter id="orders" source="csv" file="orders.csv" sortable="true"]
That renders #orders.tablecrafter-container → .tc-wrapper → .tc-table-container → table.tc-table. Add your CSS to the theme's stylesheet or Appearance → Customize → Additional CSS, scoped to #orders or .tablecrafter-container so other tables stay untouched. Enqueue order matters: your theme stylesheet should load after tablecrafter.css (the default for theme styles) so your selectors win at equal specificity.
Next, see shortcode-attributes.html for the attributes that control which of these elements render, and javascript-events.html for the client-side hooks you can listen to after the renderer mounts.