Customizing Table Cells

Hi sir Good day,How can I customize the padding and spacing in Filament tables cells
10 Replies
Dennis Koch
Dennis Koch3mo ago
I don't think we have an option for that. You'd need to override the cell styles with CSS.
J3R1CH0
J3R1CH0OP3mo ago
how to override the cell with css?
dissto
dissto3mo ago
Here is one quick and dirty approach I am using in a project to make the cell a bit more comapct. Be warned there is plenty of better ways to go about it.
.compact-table .fi-ta-text {
@apply py-1;
}

.compact-table .fi-ta-cell.px-3.py-4, .compact-table .fi-ta-cell .whitespace-nowrap.px-3.py-4 {
@apply py-1;
}
.compact-table .fi-ta-text {
@apply py-1;
}

.compact-table .fi-ta-cell.px-3.py-4, .compact-table .fi-ta-cell .whitespace-nowrap.px-3.py-4 {
@apply py-1;
}
$table
->recordClasses('compact-table')
$table
->recordClasses('compact-table')
This covers regular TextColumn and the bulk action selector. 🤪
J3R1CH0
J3R1CH0OP3mo ago
not works for me why?
No description
No description
No description
toeknee
toeknee3mo ago
I think you want: ->extraAttributes(['class' => 'compact-table']) on the table.
J3R1CH0
J3R1CH0OP3mo ago
yes sir i already create😁
Dennis Koch
Dennis Koch3mo ago
But app.css is not a Filament theme file
dissto
dissto3mo ago
Yea extraAttributes is in that case probably better. I just simplified my example because I had way more logic in recordClasses 👍 There is no extraAttributes on the $table? 🤔
LeandroFerreira
LeandroFerreira3mo ago
add this in the theme.css
.compact-table .fi-ta-text, .fi-ta-selection-cell div, .fi-ta-actions-cell div, .fi-ta-toggle {
@apply py-1
}
.compact-table .fi-ta-text, .fi-ta-selection-cell div, .fi-ta-actions-cell div, .fi-ta-toggle {
@apply py-1
}
add this to the table
public static function table(Table $table): Table
{
return $table
->recordClasses('compact-table')
...
public static function table(Table $table): Table
{
return $table
->recordClasses('compact-table')
...
run npm run build or dev...
Want results from more Discord servers?
Add your server