F
Filament2mo ago
Jakub

hiddenFrom on columns?

Is there something equivlent to visableFrom but for hideing based on breakpoint?
Tables\Columns\TextColumn::make('notes')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextColumn::make('price')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextInputColumn::make('notes')
->searchable()
->visibleFrom('lg'),
Tables\Columns\TextInputColumn::make('price')
->visibleFrom('lg')
->sortable(),
Tables\Columns\TextColumn::make('notes')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextColumn::make('price')
->hiddenFrom('lg')
->searchable(),
Tables\Columns\TextInputColumn::make('notes')
->searchable()
->visibleFrom('lg'),
Tables\Columns\TextInputColumn::make('price')
->visibleFrom('lg')
->sortable(),
1 Reply
Jakub
Jakub2mo ago
Hmm I see this
<?php

namespace Filament\Tables\Columns\Concerns;

use Closure;

trait CanBeHiddenResponsively
{
protected string | Closure | null $hiddenFrom = null;

protected string | Closure | null $visibleFrom = null;

public function hiddenFrom(string | Closure | null $breakpoint): static
{
$this->hiddenFrom = $breakpoint;

return $this;
}

public function visibleFrom(string | Closure | null $breakpoint): static
{
$this->visibleFrom = $breakpoint;

return $this;
}

public function getHiddenFrom(): ?string
{
return $this->evaluate($this->hiddenFrom);
}

public function getVisibleFrom(): ?string
{
return $this->evaluate($this->visibleFrom);
}
}
<?php

namespace Filament\Tables\Columns\Concerns;

use Closure;

trait CanBeHiddenResponsively
{
protected string | Closure | null $hiddenFrom = null;

protected string | Closure | null $visibleFrom = null;

public function hiddenFrom(string | Closure | null $breakpoint): static
{
$this->hiddenFrom = $breakpoint;

return $this;
}

public function visibleFrom(string | Closure | null $breakpoint): static
{
$this->visibleFrom = $breakpoint;

return $this;
}

public function getHiddenFrom(): ?string
{
return $this->evaluate($this->hiddenFrom);
}

public function getVisibleFrom(): ?string
{
return $this->evaluate($this->visibleFrom);
}
}
but it doesn't show the columns for me by default on small 🤔