Skip to main content
Laravel Livewire Tables uses CSS custom properties (CSS variables) for colors, allowing you to customize the entire visual theme from your configuration file.

Primary Color Palette

The colors array in config/livewire-tables.php defines the primary color used across all interactive elements:
'colors' => [
    '50'  => '#f0fdfa',
    '100' => '#ccfbf1',
    '200' => '#99f6e4',
    '400' => '#2dd4bf',
    '500' => '#14b8a6',
    '600' => '#0d9488',
    '700' => '#0f766e',
],
These colors are applied to:
  • Buttons — Filter, column visibility, and bulk action buttons
  • Checkboxes — Row selection and column toggles
  • Active states — Sorted columns, active filters, selected rows
  • Badges — Filter chips and counts
  • Focus rings — Keyboard navigation indicators
  • Hover effects — Interactive element highlights
  • Pagination — Active page indicator
Color customization works identically for both Tailwind and Bootstrap themes. You don’t need separate configurations.

How It Works

The color values are injected as CSS custom properties in the :root scope:
:root {
    --lt-primary-50:  #f0fdfa;
    --lt-primary-100: #ccfbf1;
    --lt-primary-200: #99f6e4;
    --lt-primary-400: #2dd4bf;
    --lt-primary-500: #14b8a6;
    --lt-primary-600: #0d9488;
    --lt-primary-700: #0f766e;
}
These variables are then used throughout the generated CSS:
/* Button styles */
.lt-btn-primary {
    background-color: var(--lt-primary-600) !important;
    border-color: var(--lt-primary-600) !important;
}

/* Checkbox styles */
.lt-checkbox:checked {
    background-color: var(--lt-primary-600) !important;
}

/* Hover effects */
.lt-hover-theme:hover {
    background-color: var(--lt-primary-50) !important;
    color: var(--lt-primary-700) !important;
}
Source: resources/views/components/styles.blade.php:2-9

Color Presets

The package includes six professionally designed color presets that you can use as-is or as starting points:
'colors' => [
    '50'  => '#f0fdfa',
    '100' => '#ccfbf1',
    '200' => '#99f6e4',
    '400' => '#2dd4bf',
    '500' => '#14b8a6',
    '600' => '#0d9488',
    '700' => '#0f766e',
],
Fresh, modern teal/cyan that works well in both light and dark modes.
These presets are listed in the config file comments for easy copy-paste. See config/livewire-tables.php:30-36

Custom Colors

You can use any hex color values for your palette. Here’s how to create a custom color scheme:
1

Choose Your Base Color

Start with your brand’s primary color. For example, a custom green: #10b981
2

Generate Color Shades

Create lighter and darker variations. You can:
3

Update Configuration

'colors' => [
    '50'  => '#ecfdf5',  // Lightest - backgrounds
    '100' => '#d1fae5',  // Very light - hover states
    '200' => '#a7f3d0',  // Light - badges, chips
    '400' => '#4ade80',  // Medium light - borders
    '500' => '#10b981',  // Base color - focus rings
    '600' => '#059669',  // Medium dark - primary actions
    '700' => '#047857',  // Darkest - text, active states
],
4

Test in Light and Dark Mode

Make sure your colors have sufficient contrast in both modes:
php artisan config:clear
Then view your tables in both light and dark themes.

Color Shade Usage Guide

ShadePurposeExamples
50Subtle backgrounds, hover statesButton hover, selection bar background
100Light backgrounds, secondary hoverFilter button active state, table hover
200Chips, badges, borders (light mode)Active filter chips, ring colors
400Medium contrast bordersFilter button active border, hover borders
500Focus rings, iconsForm input focus, sort icons
600Primary actions, checkboxesButtons, selected checkboxes, badges
700Text, strong emphasisActive text, sorted column headers
Shades 300, 800, and 900 are not used by the package. You only need to define seven specific shades.

CSS Custom Properties Reference

All CSS custom properties available for direct override:

Primary Color Variables

:root {
    /* Color palette */
    --lt-primary-50:  #f0fdfa;
    --lt-primary-100: #ccfbf1;
    --lt-primary-200: #99f6e4;
    --lt-primary-400: #2dd4bf;
    --lt-primary-500: #14b8a6;
    --lt-primary-600: #0d9488;
    --lt-primary-700: #0f766e;
    
    /* Semantic colors (light mode) */
    --lt-bg: #ffffff;
    --lt-bg-card: #ffffff;
    --lt-bg-subtle: #f9fafb;
    --lt-border: #e5e7eb;
    --lt-border-light: #f3f4f6;
    --lt-text: #111827;
    --lt-text-muted: #6b7280;
}
Source: resources/views/components/styles.blade.php:2-18

Overriding in Your CSS

You can override any CSS custom property in your application’s stylesheet:
/* resources/css/app.css */
:root {
    /* Override specific shades */
    --lt-primary-600: #dc2626;  /* Use red for primary actions */
    --lt-primary-700: #b91c1c;
    
    /* Override semantic colors */
    --lt-bg-card: #fafafa;
    --lt-border: #d4d4d8;
}
CSS custom property overrides must be loaded after the Livewire Tables styles to take effect.

Utility Classes

The package generates utility classes that use the configured color palette:

Background Classes

  • .lt-bg-50 — Lightest background
  • .lt-bg-600 — Primary button background
  • .lt-bg-700 — Dark primary background
  • .lt-bg-50-muted — 70% opacity light background

Text Classes

  • .lt-text-400 — Medium contrast text
  • .lt-text-500 — Base primary text
  • .lt-text-600 — Strong primary text
  • .lt-text-700 — Strongest primary text

Border Classes

  • .lt-border-100 — Light border
  • .lt-border-400 — Medium border
  • .lt-border-600 — Strong border

Hover Classes

  • .lt-hover-bg-100 — Light hover background
  • .lt-hover-bg-700 — Dark hover background
  • .lt-hover-text-600 — Hover text color
  • .lt-hover-theme — Combined hover effect (background + text + border)

Button Classes

  • .lt-btn-primary — Solid primary button
  • .lt-btn-outline-primary — Outlined primary button
  • .lt-btn-neutral — Neutral gray button
  • .lt-btn-neutral-active — Active neutral button

Badge Classes

  • .lt-badge-primary — Solid badge
  • .lt-badge-primary-soft — Soft/muted badge

Checkbox Classes

  • .lt-checkbox — Styled checkbox using primary color
Source: resources/views/components/styles.blade.php:20-76

Per-Component Color Overrides

For one-off customizations on specific tables, use inline styles or scoped CSS:
<div style="--lt-primary-600: #8b5cf6; --lt-primary-700: #7c3aed;">
    <livewire:users-table />
</div>

Framework-Specific Styling

Depending on your chosen theme, different CSS classes are applied:

Tailwind Theme

Uses utility classes + CSS custom properties:
<button class="rounded-lg lt-bg-600 text-white px-3 py-2">
  <!-- lt-bg-600 uses var(--lt-primary-600) -->
</button>

Bootstrap Theme

Uses Bootstrap classes + CSS custom properties:
<button class="btn lt-btn-primary d-flex align-items-center gap-1">
  <!-- lt-btn-primary uses var(--lt-primary-600) -->
</button>
The same colors configuration works for both themes. The package handles the framework-specific implementation.

Accessibility Considerations

When customizing colors, ensure you maintain sufficient contrast ratios:
1

Check Contrast Ratios

Use a tool like WebAIM Contrast Checker:
  • Shade 600 on white should have ≥4.5:1 ratio (WCAG AA)
  • Shade 700 text on shade 50 background should have ≥4.5:1 ratio
  • White text on shade 600 should have ≥4.5:1 ratio
2

Test with Color Blindness Simulators

Use browser DevTools or online tools to simulate different types of color blindness
3

Don't Rely on Color Alone

The package uses icons, text labels, and other visual cues in addition to color
Very light colors (yellow, lime) may not have sufficient contrast as primary colors. Consider using darker variants.

Performance Notes

CSS custom properties have excellent performance characteristics:
  • No JavaScript — All color changes are pure CSS
  • No Repaints — Changing a custom property is very efficient
  • Small Bundle Size — ~12KB of generated CSS (minified)
  • Cached — Styles are cached by the browser

Troubleshooting

Colors not updating

  1. Clear config cache: php artisan config:clear
  2. Clear view cache: php artisan view:clear
  3. Hard refresh browser: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac)
  4. Check syntax: Ensure hex colors include the # prefix

Colors look wrong in dark mode

The primary color should work in both light and dark modes. If it doesn’t:
  1. Use medium shades (500-700) for dark mode primary actions
  2. Avoid very light shades on dark backgrounds
  3. Test both modes when choosing colors

CSS not being applied

Make sure your custom CSS is loaded after the Livewire Tables styles:
<!-- In your layout -->
<head>
    @livewireStyles
    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
    <!-- ☝️ Your custom CSS should come after Livewire styles -->
</head>

Next Steps

Themes

Learn about the theme system and create custom themes

Dark Mode

Configure dark mode with custom color palettes

Build docs developers (and LLMs) love