Table Toolbar
Search, views and filters the table owns, above its card or in it, and kept in the URL.
The table owns its toolbar. Give
SlickDataTable views,
filters and search, and it holds their state beside its sorting, lays
out the controls above the card or in its top row, and keeps it all in the
URL when it has a urlKey.
- View: a named slice of the rows (Orders, Cash). One is always active; All is implicit.
- Filter: narrows within the view. A
toggleis one on/off press (Pending); aselectpicks one or many options (Type, Date). - Search: free text across the fields you choose.
Above the table
Views on the left. On the right, the common filters (Date always holds a value), every filter in All, then search. On a wide toolbar everything is open; on a narrow one (a phone) it goes quiet. A picked select shows its value and a clear button, so the active filters read at a glance.
Date | Out | In |
|---|
| 9 Oct | EU 2.625 07/04/28 Bond · Market | Buy | −€34.981,11 | 35.187 units |
| 7 Oct | Deposit SEPA · Revolut | Deposit | €35.000,00 | |
| 2 Oct | iShares Core MSCI World ETF · Limit | Buy | −€4.512,40 | 48 units |
| 28 Sept | ASML Holding Stock · Market | Sell | 12 units | €8.104,20 |
| 26 Sept | Custody fee Q3 2026 | Fee | −€12,50 | |
| 15 Sept | Apple Inc. Dividend · Withholding 15,00% | Dividend | €18,36 | |
| 4 Sept | EUR Money Market Fund Fund · Market | Buy | −€10.000,00 | 9.871 units |
| 21 Aug | Withdrawal SEPA · Revolut | Withdrawal | −€2.000,00 |
In the card
placement: "inside" puts the same toolbar in the table's own top row.
With quiet it takes the narrow layout at every width: every filter in one
icon menu beside the search icon, and the filter icon carries a count of
the filters in use.
Date | Out | In |
|---|
| 9 Oct | EU 2.625 07/04/28 Bond · Market | Buy | −€34.981,11 | 35.187 units |
| 7 Oct | Deposit SEPA · Revolut | Deposit | €35.000,00 | |
| 2 Oct | iShares Core MSCI World ETF · Limit | Buy | −€4.512,40 | 48 units |
| 28 Sept | ASML Holding Stock · Market | Sell | 12 units | €8.104,20 |
| 26 Sept | Custody fee Q3 2026 | Fee | −€12,50 | |
| 15 Sept | Apple Inc. Dividend · Withholding 15,00% | Dividend | €18,36 | |
| 4 Sept | EUR Money Market Fund Fund · Market | Buy | −€10.000,00 | 9.871 units |
| 21 Aug | Withdrawal SEPA · Revolut | Withdrawal | −€2.000,00 |
Usage
Declare views and filters once, beside the columns. A filter is not a column: it can match a value no column shows (asset class) or compute one (date presets). Values within a select are OR'd; filters are AND'd.
import {
type ColumnDef,
SlickDataTable,
type SlickDataTableSearch,
type TableFilterConfig,
type TableView,
} from "@sophic/portal-ui";
const views: TableView<Row>[] = [
{ value: "orders", label: "Orders", match: (row) => row.kind === "order" },
{ value: "cash", label: "Cash", match: (row) => row.kind === "cash" },
];
const filters: TableFilterConfig<Row>[] = [
{ type: "toggle", id: "pending", label: "Pending", match: (row) => row.pending },
{
type: "select",
id: "type",
label: "Type",
options: [{ value: "Buy" }, { value: "Sell" }],
getValue: (row) => row.type,
},
];
const search: SlickDataTableSearch<Row> = {
fields: ["name", "meta"],
placeholder: "Search activity",
};
<SlickDataTable
columns={columns}
data={rows}
views={views}
filters={filters}
search={search}
urlKey="activity"
/>;When a search or filter leaves no rows, the table shows No matches
with Clear filters. Keep views, filters and search stable
(module constants or memoized): the table re-indexes rows when they
change.
Toolbar options
toolbar on the table sets where the toolbar sits and how it lays out.
Each of filters and views is an options object, or false to leave
that part out; toolbar={false} drops the toolbar and keeps the
filtering.
| Option | Values | Default |
|---|---|---|
placement | outside (its own row above the card), inside (the card's top row) | outside |
filters | inline (ids shown as their own control, in order), menu (All) | Every filter inline; All when some aren't inline |
views | label, allLabel | Shown when there are views, on the left |
quiet | Off. On, the narrow layout at every width | |
render | (state) => ReactNode, your own layout | The layout above |
Search's look comes with its matching: placeholder, and collapsible
(true an icon, false a field, at every width). By default it is a
field when the toolbar is wide and an icon when it is narrow or quiet.
On a narrow toolbar (under 42rem, such as a phone) it goes quiet: the inline filters and All fold into the icon menu, and search closes to an icon. It follows the toolbar's own width, not the screen's, so one in a narrow column does the same.
// Common filters in the toolbar, the rest only in All
<SlickDataTable {...props} toolbar={{ filters: { inline: ["type", "pending"] } }} />
// In the card, quiet
<SlickDataTable {...props} toolbar={{ placement: "inside", quiet: true }} />Your own layout
For a screen that needs a different order, render gets the table's
state; compose the controls inside TableToolbar. Push one to the right
edge with className="ml-auto".
<SlickDataTable
{...props}
toolbar={{
render: (state) => (
<TableToolbar>
<TableViewSwitch state={state} />
<TableFilter state={state} filter="type" />
<TableSearch state={state} className="ml-auto" />
</TableToolbar>
),
}}
/>In the URL
With a urlKey, the table keeps its sort, page, search, view and filters
in the URL under that key, so a link or a reload opens the same rows.
?activity.q=bond&activity.view=orders&activity.f.currency=USD&activity.sort=-bookedAtIso&activity.page=2- Only what differs from the defaults is written; an untouched table
leaves the URL alone. A filter on its
defaultValueisn't written. - Changes replace the current history entry, so back leaves the page rather than undoing a filter.
- Values the table doesn't know (an old view, a removed option) are ignored.
- The app supplies the URL through
TableUrlProvider(portal:TableUrlLayout). Without it,urlKeydoes nothing.
Holding the state yourself
For the rare screen whose controls can't live with the table, such as a
search in the page header that drives two tables, hold the state with
useTableToolbar and place TableToolbar anywhere. Hand the table its
rows. The table's own toolbar, empty state and URL sync then don't
apply to the filtering, so reach for this only when the table can't own it.
const state = useTableToolbar({ data: rows, views, filters, search });
<TableToolbar state={state} search={{ placeholder: "Search" }} />
<SlickDataTable
columns={columns}
data={state.rows}
emptyState={<TableFilterEmpty state={state} />}
/>Search fields
search.fields lists what the query looks in: row keys, or accessors for
text no single field holds. Every word of the query must appear somewhere
in them. Leave it out to search the row's own string and number fields.
search.minChars holds the query back until it is that long (spaces
aside), so one letter doesn't narrow a long list to noise. Until then
every row shows, and if the person stops typing for 2 seconds a tooltip
under the field says how many characters it needs. Once they type on, it
goes and doesn't come back.
const search: SlickDataTableSearch<Row> = {
fields: ["name", "meta", (row) => row.order?.name],
minChars: 2,
placeholder: "Search orders",
};
<SlickDataTable columns={columns} data={rows} search={search} />;Defaults and required filters
A select filter can start on a value with defaultValue. Clearing it, or
Clear filters, goes back to that value rather than to nothing. Add
required: true when the filter must always hold a value, such as a date
range: it has no clear control, and unpicking its last value does nothing.
A required filter needs a defaultValue.
{
type: "select",
id: "date",
label: "Date",
selection: "single",
required: true,
defaultValue: "365",
options: [
{ value: "90", label: "Last 90 days" },
{ value: "365", label: "Last 12 months" },
{ value: "all", label: "All time" },
],
match: (row, value) => value === "all" || withinDays(row, Number(value)),
}A filter resting on its default doesn't count as in use: it isn't outlined, and it isn't in the All count.
Option counts
Each option shows how many rows picking it would leave, given the view, search and the other filters, so dead ends are visible before you click. They are on by default.
- Off for one filter:
counts: falsein its config. Useful for nested options such as date presets, where the numbers only stack up. - Off for the whole table, when you hold the state yourself:
useTableToolbar({ counts: false, … }). Do this whendatais one page of a server-side list: counts would only cover the rows that are loaded.
A filter's own counts wins over the table-wide setting, so a table can
switch counts off and turn them back on for one filter.
Inline label
A select's toolbar control reads Currency USD. When the value names itself,
set inlineLabel: false and the control shows only USD. The label comes
back while nothing is picked, and stays in menus and for screen readers.
Option icons
An option can lead with an icon, such as a currency's flag. It shows in
the menus, and on the control while that option is the only pick. The
label still names the option, so the icon is hidden from screen readers.
options: currencies.map((code) => ({
value: code,
icon: <CountryFlag currencyCode={code} size="xs" />,
})),Pieces
| Piece | What it does |
|---|---|
useTableToolbar | For holding the state yourself: query, view and filter values; search sets the fields and minChars. Returns rows, option counts, clear, reset |
TableSearch | Search field. Open on a wide toolbar and an icon on a narrow one; collapsible fixes either at every width. width is narrow (default) or wide, 75% wider, once open |
TableViewSwitch | Views after All. Becomes a chip Select in a narrow container |
TableFilter | One filter's control: a press for a toggle, a menu for a select |
TableFilterMenu | Every filter at once. trigger="icon" for the card toolbar |
TableToolbar | One row of controls. The table renders it from its own state; or lay it out from state, or give it children |
TableFilterEmpty | No-match body with Clear filters |
Changelog
- 3 November 2026 — Filter menus have more room: 16rem wide (was 12rem), with the check on the right edge and each option's count right after its label in a lighter muted tone.
- 13 October 2026 —
TableSearchtakeswidth:narrow(default) orwide, 75% wider once open. Withoutcollapsibleit follows the toolbar's width on its own (open when wide, an icon under 42rem), so arenderlayout gets it too. All is 2rem wider, so three currency options fit on one line. - 13 October 2026 — The table owns the toolbar:
SlickDataTabletakesviews,filtersandsearch, renders the toolbar above its card or inside it (toolbar.placement), shows No matches when filtering leaves nothing, and keeps sort, page, search, view and filters in the URL with aurlKey. Holding the state withuseTableToolbarstays for special cases. - 13 October 2026 — Renamed Table Toolbar (was Table Filters):
useTableFiltersisuseTableToolbar,TableFilterStateisTableToolbarState, andTableFilterBarisTableToolbar, with one layout above the table or inside it: views left, filters then search right. Wide, everything is open; narrow, it goes quiet.useTableToolbartakessearch(fields,minChars) in place ofsearchText; a query underminCharsshows a hint after a 2 second pause. Options take anicon(a currency flag, say),inlineLabel: falsedrops a select's name from its toolbar control, and the filters menu reads All. A picked select keeps its chevron, so it still reads as a menu. - 12 October 2026 — New. Search, views and toggle or select filters, in two layouts to compare: filter bar and card toolbar. Full notes