class BeartropyTable extends Component

Base Table Component.

This component serves as the foundation for all Beartropy Tables. It integrates various traits to provide functionality such as sorting, filtering, pagination, and bulk actions.

Traits

Properties

bool $has_bulk

Indicates if the table has bulk actions enabled.

from  Bulk
array<int|string> $yat_selected_checkbox

Array of selected row IDs for bulk actions.

from  Bulk
bool $selectAll

Controls the "Select All" checkbox state.

from  Bulk
bool $pageSelected

Indicates if the current page is selected.

from  Bulk
bool $allSelected

Indicates if all data (across all pages) is selected.

from  Bulk
string $cachePrefix

Cache prefix used in the Data trait scope.

from  Data
int|null $cacheTimeStamp

Timestamp of the cached data.

from  Cache
string $column_id

The unique identifier column for rows.

from  Columns
string $custom_column_id

A custom column ID override.

from  Columns
Collection|null $columns

Collection of defined columns.

from  Columns
bool $show_column_toggle

Whether to show the column toggle dropdown.

from  Columns
bool $column_toggle_dd_status

Status of the column toggle dropdown (open/closed).

from  Columns
bool $hasMobileCollapsedColumns

Indicates if there are columns collapsed on mobile view.

from  Columns
array $mobileCollapsedColumns

Array of columns that are collapsed on mobile.

from  Columns
int|null $all_data_count

Total count of all data records (before filtering).

from  Data
int|null $filtered_data_count

Count of data records after filtering.

from  Data
Collection|array $filters

Collection of defined filters.

from  Filters
bool $has_filters from  Filters
bool $show_filters from  Filters
array|null $options

Options available for the table (e.g. for select filters or other UI elements).

from  Options
string $paginationTheme

The pagination theme to use (e.g. 'tailwind', 'bootstrap').

from  Pagination
int|string $perPage

Number of items per page.

from  Pagination
int|string $perPageDisplay

Display value for per page selector.

from  Pagination
string[] $perPageOptions

Available options for items per page.

from  Pagination
bool $with_pagination

Indicates if pagination is enabled.

int|null $currentPageNumber

Current page number.

from  Pagination
int|bool $forcePageNumber

Force a specific page number.

from  Pagination
array $yatable_expanded_rows from  RowManipulators
bool $yatable_expanded_rows_is_component from  RowManipulators
array $yatable_expanded_rows_content from  RowManipulators
$yat_global_search from  Search
string|null $yat_global_search_label from  Search
bool $useGlobalSearch from  Search
string|null $sortColumn from  Sort
string $sortDirection from  Sort
string $trigger_spinner

Actions that trigger the loading spinner.

from  Spinner
bool $loading_table_spinner from  Spinner
string|null $loading_table_spinner_custom_view from  Spinner
bool $handle_state from  StateHandler
string $handler_prefix from  StateHandler
string|null $title from  View
string|null $titleClasses from  View
string|null $customHeader from  View
string|null $main_wrapper_classes from  View
string|null $table_classes from  View
bool $override_table_classes from  View
bool $sticky_header from  View
bool $has_counter from  View
string|null $modals_view from  View
string|null $yat_most_left_view from  View
string|null $yat_less_left_view from  View
string|null $yat_most_right_view from  View
string|null $yat_less_right_view from  View
bool $showCardsOnMobile from  View
bool $useCards from  View
bool $yat_is_mobile from  View
array $yat_custom_buttons from  View
string $yat_button_variant from  View
string $theme from  View
string|null $bulkThemeOverride from  View
string|null $buttonThemeOverride from  View
string|null $inputThemeOverride from  View
string|null $componentSizeOverride from  View
array $themeConfig from  View
array $yat_card_modal_buttons from  View
bool $mobileDetailsModalOpen from  View
array $mobileDetailsRow from  View
bool $showOptionsOnlyOnRowSelect from  View
string|null $layout

The layout to be used for rendering the table.

bool $stripRows from  View
mixed $model

The model or builder instance used for the table data.

array $with

An array of relationships to eager load.

Methods

void
emptySelection()

Clear the current selection.

from  Bulk
void
hasBulk(bool $bool)

Enable or disable bulk actions.

from  Bulk
void
updatedSelectAll(bool $value)

Handle updates to the "Select All" checkbox.

from  Bulk
void
selectCurrentPage(bool $value)

Select all rows on the current page.

from  Bulk
void
select_all_data(bool $value)

Select all rows across all pages (after filters).

from  Bulk
array<int|string>
getSelectedRows()

Get the list of selected row IDs.

from  Bulk
void
setCachePrefix(string $string)

Set the cache prefix.

from  Cache
string
getCacheKey()

Generate a unique cache key for the current user and table.

from  Cache
void
cacheData()

Cache the current user data.

from  Cache
void
clearData()

Clear the cached data for this table.

from  Cache
mixed
getCachedData()

Retrieve cached data.

from  Cache
void
updateCacheData(mixed $data)

Update the cached data with new data.

from  Cache
void
setColumns()

Initialize and process column definitions.

from  Columns
Collection
getFreshColumns()

Get a fresh collection of column instances with closures intact.

from  Columns
array
resolveSecondaryHeaders(mixed $paginatedData)

Resolve secondary header values by calling each column's callback with the current rows.

from  Columns
void
showColumnToggle(bool $bool)

Show or hide the column toggle dropdown.

from  Columns
void
setColumnID(string $column_id)

Set the primary key column used to identify rows.

from  Columns
hideOnMobile(bool $bool)

Hide this column on mobile devices.

from  Columns
showOnMobile(bool $bool = true)

Show this column only on mobile devices.

from  Columns
view(string $view)

Set a custom Blade view for rendering the column cell.

from  Columns
styling(string $classes)

Set CSS classes for the column's table cell (td).

from  Columns
thStyling(string $classes)

Set CSS classes for the column's table header (th).

from  Columns
thWrapperStyling(string $classes)

Set CSS classes for the column's header wrapper element.

from  Columns
disableToggleWhen(Closure $function)

Set a closure that determines when the toggle should be disabled.

from  Columns
hideToggleWhen(Closure $function)

Set a closure that determines when the toggle should be hidden.

from  Columns
trigger(string $trigger)

Set the method name to call when a toggle column is toggled.

from  Columns
isBool()

Mark this column as a boolean column.

from  Columns
trueIs(mixed $true)

Set the value that represents "true" for boolean columns.

from  Columns
trueLabel(string $string)

Set the display label/icon for the "true" state.

from  Columns
falseLabel(string $string)

Set the display label/icon for the "false" state.

from  Columns
toHtml()

Allow the column value to be rendered as raw HTML.

from  Columns
text(string $text)

Set the display text for a link column.

from  Columns
href(Closure $function)

Set a closure that resolves the URL for a link column.

from  Columns
target(string $target)

Set the target attribute for a link column (e.g. '_blank').

from  Columns
popup(array $array = ['width' => 750, 'height' => 800])

Open the link in a popup window with the given dimensions.

from  Columns
classes(string $classes)

Set CSS classes for a link column's anchor tag.

from  Columns
customData(Closure $function)

Set a closure to transform the column's display value.

from  Columns
hideWhen(bool $bool)

Conditionally hide the column and remove it from the column selector.

from  Columns
hideFromSelector(bool $bool)

Hide this column from the column toggle selector.

from  Columns
isVisible(bool $bool)

Set the column's initial visibility.

from  Columns
sortColumnBy(string $column)

Set an alternative column key to use when sorting this column.

from  Columns
Collection
stripModifiedRows(Collection $collection)

Strip modified row internal keys from the collection.

from  Data
Collection
getAllOriginalData()

Get all original data without modifications.

from  Data
Collection
getAllData()

Get all data available to the table.

from  Data
Collection
getAfterFiltersOriginalData()

Get original data after filters are applied.

from  Data
Collection
getAfterFiltersData()

Get data after applying search, filters, and sorting.

from  Data
Collection
getSelectedOriginalData()

Get selected original data without modifications.

from  Data
Collection
getSelectedData()

Get selected rows data.

from  Data
mixed|null
getRowByID(mixed $id)

Get a single row by its ID.

from  Data
Collection
getCurrentPageData()

Get data for the current page.

from  Data
void
parseData()

Parse and cache the initial data.

from  Data
Collection
processCollection(Collection $collection)

Process a collection of rows.

from  Data
array
transformRow(mixed $row, array $customData, array $linkColumns, array $toggleColumns, array $cardTitleCallbacks = [])

Transform a single row.

from  Data
array
getColumnMetadata()

Get all column metadata in a single pass over getFreshColumns().

from  Data
void
exportToClipboard(Collection $collection, bool $tabs = true)

Export the current table data to clipboard (CSV/TSV).

from  Data
bool
authorizeFieldUpdate(Model $record, string $field, mixed $value)

Authorize a field update before persisting.

from  Editable
bool|void
updateField(mixed $id, string $field, mixed $value)

Update a specific field for a row.

from  Editable
void
setFilters()

Initialize filters.

from  Filters
string
getColumnKey(string $filter_label)

Identify the column key from a filter label.

from  Filters
void
updatedFilters(string $key, mixed $value)

Handle updates to filter inputs.

from  Filters
Collection
applyFilters(Collection $data)

Apply filters to the data collection (Array/Collection mode).

from  Filters
Collection
getFreshFilters()

Get a fresh instance of filters with current state merged.

from  Filters
Builder
applyFiltersToQuery(Builder $query)

Apply filters to the Eloquent query.

from  Filters
void
clearAllFilters(bool $selectAll = false)

Clear all active filters and search.

from  Filters
void
setOptions()

Initialize and normalize options.

from  Options
void
updatedPerPageDisplay(string|int $value)

Update the per-page display value.

void
usePagination(bool $bool)

Enable or disable pagination.

void
setPerPageDefault(int $number)

Set the default items per page.

void
setPerPageOptions(array $array)

Set available per-page options.

LengthAwarePaginator
paginateData()

specific method to handle pagination logic.

LengthAwarePaginator
getPageData(int $currentPage)

Get paginated data for a specific page number.

void
removeRowFromTable(mixed $id, bool $resetSelected = true)

Remove a row from the table data (and cache).

void
addRowToTable(array $row)

Add a new row to the table data (and cache).

void
toggleExpandedRow(mixed $rowId, mixed $content, bool $is_component = false)

Toggle the expansion state of a row.

void
updateRowOnTable(mixed $id, array $newData)

Update a row's data in the table (and cache).

void
expandMobileRow(mixed $rowId)

Expand the mobile details view for a row.

void
toggleBoolean(mixed $id, string $column)

Toggle a boolean column value for a row.

void
useGlobalSearch(bool $status = true)

Enable or disable global search.

from  Search
void
setSearchLabel(string $label)

Set the label for the global search input.

from  Search
void
updatingSearch()

Handle updates to the global search input.

from  Search
Collection
filteredData()

Filter the data based on global search (Array mode).

from  Search
Builder
applySearchToQuery(Builder $query)

Apply global search to the Eloquent query.

from  Search
void
setSortDirectionAsc(bool $bool)

Set sort direction to ascending.

from  Sort
void
setSortDirectionDesc(bool $bool)

Set sort direction to descending.

from  Sort
void
setSortColumn(string $column)

Set the column to sort by.

from  Sort
void
sortBy(string $column)

Toggle sorting for a specific column.

from  Sort
Collection
sortData(Collection $data)

Sort the data collection (Array mode).

from  Sort
Builder
applySortToQuery(Builder $query)

Apply sorting to the Eloquent query.

from  Sort
void
useTableSpinner(bool $bool)

Enable or disable the table loading spinner.

from  Spinner
void
setTableSpinnerView(string $view)

Set a custom view for the loading spinner.

from  Spinner
void
addTargetsToSpinner(array $targets)

Add more triggers (methods/properties) to the spinner.

from  Spinner
void
useStateHandler(bool $bool)

Enable or disable persisting column visibility to the database.

void
setHandlerPrefix(string $string)

Set a prefix for the state handler key to differentiate tables.

void
saveTableState()

Save the current column visibility state to the database.

void
setTableState()

Restore column visibility state from the database.

void
setTheme(string $theme)

Set the table theme.

from  View
array
getThemeConfig(string $theme)

Get configuration for a specific theme from presets.

from  View
void
setBulkThemeOverride(string|null $theme)

Override the bulk actions theme.

from  View
void
setButtonThemeOverride(string|null $theme)

Override the button theme.

from  View
void
setInputThemeOverride(string|null $theme)

Override specific theme settings.

from  View
void
setComponentSize(string|null $size)

Override the size of all beartropy-ui components in the table header.

from  View
void
mountView()

Initialize view settings.

from  View
void
gatherEnvData()

Detect environmental data (e.g. mobile device).

from  View
void
addButtons(array $buttons)

Add custom buttons to the table header.

from  View
void
addCardModalButtons(array $buttons)

Add buttons to the card modal view.

from  View
void
showCounter(bool $bool)

Toggle the record counter display.

from  View
void
showCardsOnMobile(bool $bool = true)

Enable or disable card view on mobile devices.

from  View
void
useCards(bool $bool = true)

Enable or disable card layout for all devices.

from  View
void
openMobileCardDetails(mixed $rowId)

Open the mobile details modal for a specific row.

from  View
void
closeMobileCardDetails()

Close the mobile details modal.

from  View
void
setTitle(string $title)

Set the table title.

from  View
void
overrideTitleClasses(string $classes)

Override default title classes.

from  View
void
setCustomHeader(string $html)

Set custom HTML content for the header.

from  View
void
setComponentClasses(string $classes)

Set CSS classes for the main component wrapper.

from  View
void
addTableClasses(string $classes)

Add CSS classes to the table element.

from  View
void
setTableClasses(string $classes)

Set (overwrite) CSS classes for the table element.

from  View
void
setStickyHeader()

Enable sticky header for the table.

from  View
void
setModalsView(string $view)

Set the view for modals.

from  View
void
setMostLeftView(string $view)

Set the view for the leftmost header area.

from  View
void
setLessLeftView(string $view)

Set the view for the inner left header area.

from  View
void
setMostRightView(string $view)

Set the view for the rightmost header area.

from  View
void
setLessRightView(string $view)

Set the view for the inner right header area.

from  View
void
setButtonVariant(string $variant)

Set the button variant style.

from  View
void
showOptionsOnlyOnRowSelect(bool $value = true)

Configure options visibility based on row selection specific logic.

from  View
void
setLayout(mixed $layout)

Set the main layout view.

from  View
void
stripRows(bool $strip = true)

Enable or disable striped rows.

from  View
string
getRowStripingClasses()

Get the CSS classes for row striping based on configuration.

from  View
Builder
query()

Base query for model-based tables.

Builder
newQuery()

Build a new query with eager loading applied.

void
refresh()

Refresh the table component.

void
mount()

Initialize the component.

void
showOnlyTable(bool $status = true)

Configure the table display mode.

View
render()

Render the component.

Details

in Bulk at line 41
void emptySelection()

Clear the current selection.

Resets the selected checkboxes and the "select all" state.

Return Value

void

in Bulk at line 52
void hasBulk(bool $bool)

Enable or disable bulk actions.

Parameters

bool $bool

Return Value

void

in Bulk at line 65
void updatedSelectAll(bool $value)

Handle updates to the "Select All" checkbox.

This method is triggered by Livewire when $selectAll property changes.

Parameters

bool $value

The new value of the checkbox.

Return Value

void

in Bulk at line 76
void selectCurrentPage(bool $value)

Select all rows on the current page.

Parameters

bool $value

If true, selects all rows on the current page. If false, deselects them.

Return Value

void

in Bulk at line 91
void select_all_data(bool $value)

Select all rows across all pages (after filters).

Parameters

bool $value

If true, selects all matching rows. If false, clears selection.

Return Value

void

in Bulk at line 105
array<int|string> getSelectedRows()

Get the list of selected row IDs.

Return Value

array<int|string>

in Cache at line 26
void setCachePrefix(string $string)

Set the cache prefix.

Parameters

string $string

The prefix string.

Return Value

void

in Cache at line 36
protected string getCacheKey()

Generate a unique cache key for the current user and table.

Return Value

string

in Cache at line 50
void cacheData()

Cache the current user data.

Stores the data in the cache for 60 minutes and updates the timestamp.

Return Value

void

in Cache at line 64
void clearData()

Clear the cached data for this table.

Return Value

void

in Cache at line 76
mixed getCachedData()

Retrieve cached data.

If cache is missing, it attempts to re-initialize the component (mount).

Return Value

mixed

The cached data.

in Cache at line 93
void updateCacheData(mixed $data)

Update the cached data with new data.

Clears current selection and updates the cache with the new data set.

Parameters

mixed $data

The new data to cache.

Return Value

void

in Columns at line 53
void setColumns()

Initialize and process column definitions.

Handles mobile visibility, collapse behavior, and strips closures for Livewire serialization.

Return Value

void

in Columns at line 99
Collection getFreshColumns()

Get a fresh collection of column instances with closures intact.

Return Value

Collection

in Columns at line 114
array resolveSecondaryHeaders(mixed $paginatedData)

Resolve secondary header values by calling each column's callback with the current rows.

Parameters

mixed $paginatedData

Return Value

array

in Columns at line 136
void showColumnToggle(bool $bool)

Show or hide the column toggle dropdown.

Parameters

bool $bool

Return Value

void

in Columns at line 146
void setColumnID(string $column_id)

Set the primary key column used to identify rows.

Parameters

string $column_id

Return Value

void

in Columns at line 154
Columns hideOnMobile(bool $bool)

Hide this column on mobile devices.

Parameters

bool $bool

Return Value

Columns

in Columns at line 164
Columns showOnMobile(bool $bool = true)

Show this column only on mobile devices.

Parameters

bool $bool

Return Value

Columns

in Columns at line 176
Columns view(string $view)

Set a custom Blade view for rendering the column cell.

Parameters

string $view

Return Value

Columns

in Columns at line 187
Columns styling(string $classes)

Set CSS classes for the column's table cell (td).

Parameters

string $classes

Return Value

Columns

in Columns at line 197
Columns thStyling(string $classes)

Set CSS classes for the column's table header (th).

Parameters

string $classes

Return Value

Columns

in Columns at line 207
Columns thWrapperStyling(string $classes)

Set CSS classes for the column's header wrapper element.

Parameters

string $classes

Return Value

Columns

in Columns at line 217
Columns disableToggleWhen(Closure $function)

Set a closure that determines when the toggle should be disabled.

Parameters

Closure $function

Return Value

Columns

in Columns at line 227
Columns hideToggleWhen(Closure $function)

Set a closure that determines when the toggle should be hidden.

Parameters

Closure $function

Return Value

Columns

in Columns at line 237
Columns trigger(string $trigger)

Set the method name to call when a toggle column is toggled.

Parameters

string $trigger

Return Value

Columns

in Columns at line 247
Columns isBool()

Mark this column as a boolean column.

Return Value

Columns

in Columns at line 259
Columns trueIs(mixed $true)

Set the value that represents "true" for boolean columns.

Parameters

mixed $true

Return Value

Columns

in Columns at line 271
Columns trueLabel(string $string)

Set the display label/icon for the "true" state.

Parameters

string $string

Return Value

Columns

in Columns at line 283
Columns falseLabel(string $string)

Set the display label/icon for the "false" state.

Parameters

string $string

Return Value

Columns

in Columns at line 293
Columns toHtml()

Allow the column value to be rendered as raw HTML.

Return Value

Columns

in Columns at line 305
Columns text(string $text)

Set the display text for a link column.

Parameters

string $text

Return Value

Columns

in Columns at line 317
Columns href(Closure $function)

Set a closure that resolves the URL for a link column.

Parameters

Closure $function

Return Value

Columns

in Columns at line 329
Columns target(string $target)

Set the target attribute for a link column (e.g. '_blank').

Parameters

string $target

Return Value

Columns

in Columns at line 343
Columns popup(array $array = ['width' => 750, 'height' => 800])

Open the link in a popup window with the given dimensions.

Parameters

array $array

Return Value

Columns

in Columns at line 357
Columns classes(string $classes)

Set CSS classes for a link column's anchor tag.

Parameters

string $classes

Return Value

Columns

in Columns at line 369
Columns customData(Closure $function)

Set a closure to transform the column's display value.

Parameters

Closure $function

Return Value

Columns

in Columns at line 379
Columns hideWhen(bool $bool)

Conditionally hide the column and remove it from the column selector.

Parameters

bool $bool

Return Value

Columns

in Columns at line 392
Columns hideFromSelector(bool $bool)

Hide this column from the column toggle selector.

Parameters

bool $bool

Return Value

Columns

in Columns at line 402
Columns isVisible(bool $bool)

Set the column's initial visibility.

Parameters

bool $bool

Return Value

Columns

in Columns at line 412
Columns sortColumnBy(string $column)

Set an alternative column key to use when sorting this column.

Parameters

string $column

Return Value

Columns

in Data at line 32
Collection stripModifiedRows(Collection $collection)

Strip modified row internal keys from the collection.

Removes keys ending with '_original' and potentially restores original values.

Parameters

Collection $collection

Return Value

Collection

in Data at line 55
Collection getAllOriginalData()

Get all original data without modifications.

Return Value

Collection

in Data at line 67
Collection getAllData()

Get all data available to the table.

Fetches from model/database if configured, or returns cached data.

Return Value

Collection

in Data at line 83
Collection getAfterFiltersOriginalData()

Get original data after filters are applied.

Return Value

Collection

in Data at line 93
Collection getAfterFiltersData()

Get data after applying search, filters, and sorting.

Return Value

Collection

in Data at line 133
Collection getSelectedOriginalData()

Get selected original data without modifications.

Return Value

Collection

in Data at line 143
Collection getSelectedData()

Get selected rows data.

Return Value

Collection

in Data at line 166
mixed|null getRowByID(mixed $id)

Get a single row by its ID.

Parameters

mixed $id

Return Value

mixed|null

in Data at line 188
Collection getCurrentPageData()

Get data for the current page.

Return Value

Collection

in Data at line 210
void parseData()

Parse and cache the initial data.

Clears existing cache, resets pagination, and re-processes data from source. Dispatches events based on data availability.

Return Value

void

in Data at line 236
Collection processCollection(Collection $collection)

Process a collection of rows.

Applies transformations (custom data, links, toggles) to each row.

Parameters

Collection $collection

Return Value

Collection

in Data at line 274
array transformRow(mixed $row, array $customData, array $linkColumns, array $toggleColumns, array $cardTitleCallbacks = [])

Transform a single row.

Parameters

mixed $row

The row object or array.

array $customData
array $linkColumns
array $toggleColumns
array $cardTitleCallbacks

Return Value

array

The transformed row data.

in Data at line 375
array getColumnMetadata()

Get all column metadata in a single pass over getFreshColumns().

Consolidates custom data, link columns, toggle columns, and card title callbacks to avoid iterating the column definitions multiple times.

Return Value

array

in Data at line 428
void exportToClipboard(Collection $collection, bool $tabs = true)

Export the current table data to clipboard (CSV/TSV).

Parameters

Collection $collection
bool $tabs

If true, uses tabs (TSV); otherwise uses commas (CSV).

Return Value

void

in Editable at line 19
bool authorizeFieldUpdate(Model $record, string $field, mixed $value)

Authorize a field update before persisting.

Override this method in your table component to add policy checks or custom authorization logic.

Parameters

Model $record

The Eloquent model being updated.

string $field

The field/column key being updated.

mixed $value

The new value.

Return Value

bool

in Editable at line 35
bool|void updateField(mixed $id, string $field, mixed $value)

Update a specific field for a row.

Handles inline editing updates. Supports callbacks, Eloquent models, and array data. Dispatches 'table-field-updated' event.

Parameters

mixed $id

The row ID.

string $field

The field/column key to update.

mixed $value

The new value.

Return Value

bool|void

Returns true if successful, false otherwise.

in Filters at line 28
void setFilters()

Initialize filters.

Processes defined filters, resolving keys, options (for magic-select), and serializing them for Livewire.

Return Value

void

in Filters at line 141
string getColumnKey(string $filter_label)

Identify the column key from a filter label.

Parameters

string $filter_label

Return Value

string

Exceptions

Exception

in Filters at line 161
void updatedFilters(string $key, mixed $value)

Handle updates to filter inputs.

Triggered by Livewire when filter properties change.

Parameters

string $key
mixed $value

Return Value

void

in Filters at line 210
Collection applyFilters(Collection $data)

Apply filters to the data collection (Array/Collection mode).

Parameters

Collection $data

Return Value

Collection

in Filters at line 270
Collection getFreshFilters()

Get a fresh instance of filters with current state merged.

Re-initializes filters (e.g. to get closures back) and merges the Livewire state (inputs).

Return Value

Collection

in Filters at line 316
Builder applyFiltersToQuery(Builder $query)

Apply filters to the Eloquent query.

Parameters

Builder $query

Return Value

Builder

in Filters at line 419
void clearAllFilters(bool $selectAll = false)

Clear all active filters and search.

Parameters

bool $selectAll

Whether to select all data after clearing.

Return Value

void

in Options at line 19
void setOptions()

Initialize and normalize options.

Converts string options to ['label' => '...', 'icon' => null] format.

Return Value

void

in Pagination at line 53
void updatedPerPageDisplay(string|int $value)

Update the per-page display value.

Handles the 'Total' option to show all records. Resets selection when page size changes.

Parameters

string|int $value

Return Value

void

in Pagination at line 74
void usePagination(bool $bool)

Enable or disable pagination.

Parameters

bool $bool

Return Value

void

in Pagination at line 85
void setPerPageDefault(int $number)

Set the default items per page.

Parameters

int $number

Passing 0 sets it to 'Total' (all items).

Return Value

void

in Pagination at line 101
void setPerPageOptions(array $array)

Set available per-page options.

Parameters

array $array

Return Value

void

in Pagination at line 114
LengthAwarePaginator paginateData()

specific method to handle pagination logic.

Applies search, filters, and sort logic to the query or collection, then paginates the result.

Return Value

LengthAwarePaginator

in Pagination at line 182
LengthAwarePaginator getPageData(int $currentPage)

Get paginated data for a specific page number.

Used for array-based data sources where we slice the collection manually.

Parameters

int $currentPage

Return Value

LengthAwarePaginator

in RowManipulators at line 22
void removeRowFromTable(mixed $id, bool $resetSelected = true)

Remove a row from the table data (and cache).

Parameters

mixed $id
bool $resetSelected

Whether to clear selection after removal.

Return Value

void

in RowManipulators at line 40
void addRowToTable(array $row)

Add a new row to the table data (and cache).

Parameters

array $row

Return Value

void

in RowManipulators at line 64
void toggleExpandedRow(mixed $rowId, mixed $content, bool $is_component = false)

Toggle the expansion state of a row.

Parameters

mixed $rowId
mixed $content

Content string or array if is_component is true.

bool $is_component

Whether the content points to a Livewire component.

Return Value

void

Exceptions

Exception

in RowManipulators at line 90
void updateRowOnTable(mixed $id, array $newData)

Update a row's data in the table (and cache).

Parameters

mixed $id
array $newData

Key-value pairs to update.

Return Value

void

in RowManipulators at line 109
void expandMobileRow(mixed $rowId)

Expand the mobile details view for a row.

Parameters

mixed $rowId

Return Value

void

in RowManipulators at line 137
void toggleBoolean(mixed $id, string $column)

Toggle a boolean column value for a row.

Dispatches trigger method if defined on the column.

Parameters

mixed $id
string $column

Column key.

Return Value

void

in Search at line 18
void useGlobalSearch(bool $status = true)

Enable or disable global search.

Parameters

bool $status

Return Value

void

in Search at line 28
void setSearchLabel(string $label)

Set the label for the global search input.

Parameters

string $label

Return Value

void

in Search at line 40
void updatingSearch()

Handle updates to the global search input.

Resets pagination when search query changes.

Return Value

void

in Search at line 50
Collection filteredData()

Filter the data based on global search (Array mode).

Return Value

Collection

in Search at line 91
Builder applySearchToQuery(Builder $query)

Apply global search to the Eloquent query.

Parameters

Builder $query

Return Value

Builder

in Sort at line 16
void setSortDirectionAsc(bool $bool)

Set sort direction to ascending.

Parameters

bool $bool

Return Value

void

in Sort at line 28
void setSortDirectionDesc(bool $bool)

Set sort direction to descending.

Parameters

bool $bool

Return Value

void

in Sort at line 40
void setSortColumn(string $column)

Set the column to sort by.

Parameters

string $column

Return Value

void

in Sort at line 51
void sortBy(string $column)

Toggle sorting for a specific column.

Parameters

string $column

Return Value

void

in Sort at line 78
Collection sortData(Collection $data)

Sort the data collection (Array mode).

Parameters

Collection $data

Return Value

Collection

in Sort at line 125
Builder applySortToQuery(Builder $query)

Apply sorting to the Eloquent query.

Handles relationship sorting and custom callbacks.

Parameters

Builder $query

Return Value

Builder

in Spinner at line 21
void useTableSpinner(bool $bool)

Enable or disable the table loading spinner.

Parameters

bool $bool

Return Value

void

in Spinner at line 31
void setTableSpinnerView(string $view)

Set a custom view for the loading spinner.

Parameters

string $view

Return Value

void

in Spinner at line 41
void addTargetsToSpinner(array $targets)

Add more triggers (methods/properties) to the spinner.

Parameters

array $targets

Return Value

void

in StateHandler at line 19
void useStateHandler(bool $bool)

Enable or disable persisting column visibility to the database.

Parameters

bool $bool

Return Value

void

in StateHandler at line 29
void setHandlerPrefix(string $string)

Set a prefix for the state handler key to differentiate tables.

Parameters

string $string

Return Value

void

in StateHandler at line 39
void saveTableState()

Save the current column visibility state to the database.

Return Value

void

in StateHandler at line 60
void setTableState()

Restore column visibility state from the database.

Return Value

void

in View at line 60
void setTheme(string $theme)

Set the table theme.

Parameters

string $theme

Return Value

void

in View at line 71
array getThemeConfig(string $theme)

Get configuration for a specific theme from presets.

Parameters

string $theme

Return Value

array

in View at line 83
void setBulkThemeOverride(string|null $theme)

Override the bulk actions theme.

Parameters

string|null $theme

Return Value

void

in View at line 93
void setButtonThemeOverride(string|null $theme)

Override the button theme.

Parameters

string|null $theme

Return Value

void

in View at line 103
void setInputThemeOverride(string|null $theme)

Override specific theme settings.

Parameters

string|null $theme

Return Value

void

in View at line 113
void setComponentSize(string|null $size)

Override the size of all beartropy-ui components in the table header.

Parameters

string|null $size

Return Value

void

in View at line 123
void mountView()

Initialize view settings.

Return Value

void

in View at line 135
void gatherEnvData()

Detect environmental data (e.g. mobile device).

Return Value

void

in View at line 148
void addButtons(array $buttons)

Add custom buttons to the table header.

Parameters

array $buttons

Return Value

void

in View at line 160
void addCardModalButtons(array $buttons)

Add buttons to the card modal view.

Parameters

array $buttons

Return Value

void

in View at line 170
void showCounter(bool $bool)

Toggle the record counter display.

Parameters

bool $bool

Return Value

void

in View at line 180
void showCardsOnMobile(bool $bool = true)

Enable or disable card view on mobile devices.

Parameters

bool $bool

Return Value

void

in View at line 190
void useCards(bool $bool = true)

Enable or disable card layout for all devices.

Parameters

bool $bool

Return Value

void

in View at line 205
void openMobileCardDetails(mixed $rowId)

Open the mobile details modal for a specific row.

Parameters

mixed $rowId

Return Value

void

in View at line 216
void closeMobileCardDetails()

Close the mobile details modal.

Return Value

void

in View at line 228
void setTitle(string $title)

Set the table title.

Parameters

string $title

Return Value

void

in View at line 239
void overrideTitleClasses(string $classes)

Override default title classes.

Parameters

string $classes

Return Value

void

in View at line 250
void setCustomHeader(string $html)

Set custom HTML content for the header.

Parameters

string $html

Return Value

void

in View at line 260
void setComponentClasses(string $classes)

Set CSS classes for the main component wrapper.

Parameters

string $classes

Return Value

void

in View at line 270
void addTableClasses(string $classes)

Add CSS classes to the table element.

Parameters

string $classes

Return Value

void

in View at line 280
void setTableClasses(string $classes)

Set (overwrite) CSS classes for the table element.

Parameters

string $classes

Return Value

void

in View at line 291
void setStickyHeader()

Enable sticky header for the table.

Return Value

void

in View at line 301
void setModalsView(string $view)

Set the view for modals.

Parameters

string $view

Return Value

void

in View at line 311
void setMostLeftView(string $view)

Set the view for the leftmost header area.

Parameters

string $view

Return Value

void

in View at line 321
void setLessLeftView(string $view)

Set the view for the inner left header area.

Parameters

string $view

Return Value

void

in View at line 331
void setMostRightView(string $view)

Set the view for the rightmost header area.

Parameters

string $view

Return Value

void

in View at line 341
void setLessRightView(string $view)

Set the view for the inner right header area.

Parameters

string $view

Return Value

void

in View at line 351
void setButtonVariant(string $variant)

Set the button variant style.

Parameters

string $variant

Return Value

void

in View at line 363
void showOptionsOnlyOnRowSelect(bool $value = true)

Configure options visibility based on row selection specific logic.

Parameters

bool $value

Return Value

void

in View at line 376
void setLayout(mixed $layout)

Set the main layout view.

Parameters

mixed $layout

Return Value

void

in View at line 388
void stripRows(bool $strip = true)

Enable or disable striped rows.

Parameters

bool $strip

Return Value

void

in View at line 398
string getRowStripingClasses()

Get the CSS classes for row striping based on configuration.

Return Value

string

at line 81
Builder query()

Base query for model-based tables.

Override this method to scope the base query (e.g., by tenant, permissions, etc.). The $with eager loading is applied automatically via newQuery() — no need to add it here.

Return Value

Builder

at line 94
protected Builder newQuery()

Build a new query with eager loading applied.

Internal method — wraps query() and applies $this->with. All internal data-fetching code should call this instead of query() directly.

Return Value

Builder

at line 111
void refresh()

Refresh the table component.

This method acts as a listener for the 'refresh' event. It re-initializes the component by calling the mount method.

Return Value

void

at line 126
void mount()

Initialize the component.

This method prepares the environment, settings, columns, options, filters, and view configurations. If no model is provided, it attempts to parse and cache data.

Return Value

void

at line 150
void showOnlyTable(bool $status = true)

Configure the table display mode.

Helper to quickly enable or disable table-only view. Disabling "only table" enables global search, pagination, and column toggle.

Parameters

bool $status

Whether to show only the table (defaults to true).

Return Value

void

at line 165
View render()

Render the component.

Calculates the data to be displayed, applying sorting and filtering if pagination is not used. Returns the view with the row data.

Return Value

View

The rendered view.