Beartropy Tables
Conditional Hiding
Hide columns based on conditions or user permissions.
hideWhen()
hideWhen(bool $bool) — Completely hides the column. When true, the user cannot access it at all.
1Column::make('Only Admins','sensitive-row')2 ->hideWhen(Auth::user()->isAdmin)
Hide from Column Selector
hideFromSelector(bool $bool) — Prevents the column from appearing in the column toggle dropdown, so it's always visible and cannot be turned off by the user.
1Column::make('Always visible','force-data')2 ->hideFromSelector(true)
Default Visibility
isVisible(bool $bool) — Set to false to hide the column by default. Users can still enable it via the column toggle.
1Column::make('Not so important data','meh-column')2 ->isVisible(false)
Toggle Control
Fine-grained control over the column toggle dropdown behavior.
Disable & Hide Toggles
disableToggleWhen(Closure $fn) — Disable the toggle switch based on a condition.
hideToggleWhen(Closure $fn) — Hide the toggle switch entirely based on a condition.
1Column::make('Critical Data','important_field')2 ->disableToggleWhen(fn() => !Auth::user()->isSuperAdmin())3 ->hideToggleWhen(fn() => $this->isLocked)
Mobile & Card View
Control column behavior on mobile devices and in card layout mode.
Hide on Mobile
hideOnMobile(bool $bool) — Automatically hide this column on mobile viewports.
1Column::make('Description','desc')2 ->hideOnMobile(true)
Collapse on Mobile
collapseOnMobile(bool $bool) — Hides the column from the main table on mobile, but its content remains visible in the expanded row details when the user taps a row.
1Column::make('Description','desc')2 ->collapseOnMobile(true)
Card Title
cardTitle() — Sets this column as the primary title for the card view. The title becomes clickable and opens the details modal.
1Column::make('Name', 'name')->cardTitle()
Show on Card Body
showOnCard() — Includes this column in the card body. Columns without cardTitle() or showOnCard() will only appear in the details modal.
1Column::make('Description', 'desc')->showOnCard()