Introduction
The color column displays a color preview from a CSS color value:
use Filament\Tables\Columns\ColorColumn;
ColorColumn::make('color')
The column supports various color formats: HEX, HSL, RGB, and RGBA.
Making colors copyable
Allow users to copy the color value to clipboard:
ColorColumn::make('color')
->copyable()
->copyMessage('Copied!')
->copyMessageDuration(1500)
condition
bool | Closure
default:"true"
Whether the color should be copyable.
message
string | Closure
default:"'Copied'"
The message to display when copied.
duration
int | Closure
default:"2000"
How long to show the message (milliseconds).
This feature requires SSL to be enabled for your application.
Wrapping color blocks
Allow multiple color blocks to wrap to multiple lines:
ColorColumn::make('color')
->wrap()
Multiple colors
When the column state is an array, multiple color blocks will be displayed:
// Displays multiple color swatches
ColorColumn::make('palette_colors')
The column automatically handles arrays and collections of color values.