Replies: 2 comments 1 reply
-
via ->formatStateUsing(fn (Column $column, $state): string => $column->getLabel() . ': ' . $state) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @khanakia! You can show labels for each value in Split/Stack layouts by using use Filament\Tables\Columns\Layout\Split;
use Filament\Tables\Columns\Layout\Stack;
use Filament\Tables\Columns\TextColumn;
Split::make([
TextColumn::make('name')
->label('Name')
->formatStateUsing(fn ($state, $column) => "{$column->getLabel()}: {$state}"),
Stack::make([
TextColumn::make('phone')
->label('Phone')
->formatStateUsing(fn ($state, $column) => "{$column->getLabel()}: {$state}")
->icon('heroicon-m-phone'),
TextColumn::make('email')
->label('Email')
->formatStateUsing(fn ($state, $column) => "{$column->getLabel()}: {$state}")
->icon('heroicon-m-envelope'),
]),
])
protected function formatColumnWithLabel(): Closure
{
return fn ($state, $column) => "{$column->getLabel()}: {$state}";
}
// Then use it like:
Split::make([
TextColumn::make('name')
->formatStateUsing($this->formatColumnWithLabel()),
Stack::make([
TextColumn::make('phone')
->formatStateUsing($this->formatColumnWithLabel()),
TextColumn::make('email')
->formatStateUsing($this->formatColumnWithLabel()),
]),
]) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using this example to Stack the Values on Mobile https://filamentphp.com/docs/3.x/tables/layout#stacking-within-a-split
But i want to show the labels for each value. How do i achieve this?
Beta Was this translation helpful? Give feedback.
All reactions