# Application Filters and Search: Sort Density Toolbar

Working sort and density controls wired to a demo table that responds.

- Page: https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/sort-density-toolbar
- Collection: [Application](https://www.shadcn-ui-blocks.com/blocks/application-pro), Standard tier
- Group: [Filters and Search](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search)
- Created: 2026-06-15
- Preview image: https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/sort-density-toolbar.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/application-pro-filters-and-search-sort-density-toolbar
```

Needs an API key from a Pro or Team plan: add `@shadcn-ui-blocks` to the registries in components.json with the key as an `Authorization: Bearer` header. Setup: https://www.shadcn-ui-blocks.com/docs/shadcn-cli. The MCP server installs it without the setup: https://www.shadcn-ui-blocks.com/docs/mcp.

## Depends on

- npm packages: class-variance-authority, lucide-react, radix-ui
- shadcn/ui components: badge, button, table, toggle, toggle-group
- Installs to: `@/components/blocks/application-pro/filters-and-search/sort-density-toolbar`

## About this block

Sort Density Toolbar is the table controls bar wired to
a real demo table, sort chips (Newest, Oldest, A to Z)
with aria-pressed that actually reorder the three report
rows, a ToggleGroup switching between Comfortable and
Compact that changes row padding live, and a column
visibility button showing 9 of 12 columns. The table
shows Q2 revenue, Activation funnel, and Churn cohorts
with status badges and last edited timestamps.

Sort options and report rows are const arrays; useState
drives sort key and density. The footer note explains
that compact only tightens padding and nothing reflows
on switch, which is the guarantee users need before
they trust the toggle.

## When to use

Reach for this block above any data table where users
have sorting preferences and varying screen density
needs, wired to your table sort state and user
preferences endpoint. Persist density preference to
localStorage or a user settings API so the choice
survives page loads.

A natural flow around it on an Application Pro page:

**Before**

- [App shell](https://www.shadcn-ui-blocks.com/blocks/application-pro/app-shells)
- [Faceted filter bar](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search)

**After**

- [Data table](https://www.shadcn-ui-blocks.com/blocks/application-pro/data-tables)
- [Empty states](https://www.shadcn-ui-blocks.com/blocks/application-pro/empty-states)

## What you can display

One strong use is the reports table toolbar. Other
sort and density toolbars:

- **Contacts table toolbar.** Sort by name, company, or
  last contacted with a compact mode for long lists.
- **Activity feed toolbar.** Newest / oldest toggle
  plus a density switch for dense audit logs.
- **Pipeline table toolbar.** Sort by deal size or close
  date beside a column picker with stage columns.

> Tip: compact tightens padding only; if column widths
> shift or text truncates differently, users cannot
> trust the toggle and will leave it alone.

## More in Application Filters and Search

- [Advanced Filter Builder](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/advanced-filter-builder)
- [Applied Filters Summary](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/applied-filters-summary)
- [Column Filter Blueprint](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/column-filter-blueprint)
- [Date Range Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/date-range-panel)
- [Faceted Filter Bar](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/faceted-filter-bar)
- [Filter Chips Row](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/filter-chips-row)
- [Filter Funnel Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/filter-funnel-panel)
- [Find In View Bar](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/find-in-view-bar)
- [Group By Selector](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/group-by-selector)
- [Grouped Results Blueprint](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/grouped-results-blueprint)
- [Include Exclude Tags](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/include-exclude-tags)
- [Multi Facet Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/multi-facet-panel)
- [Multi Sort Builder](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/multi-sort-builder)
- [Query Language Bar](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/query-language-bar)
- [Quick Filter Toggles](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/quick-filter-toggles)
- [Range Filter Histogram](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/range-filter-histogram)
- [Recent And Saved Blueprint](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/recent-and-saved-blueprint)
- [Results Density Toggle](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/results-density-toggle)
- [Saved Filter Pills](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/saved-filter-pills)
- [Saved Searches Manager](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/saved-searches-manager)
- [Saved Views Tabs](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/saved-views-tabs)
- [Scope Selector Bar](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/scope-selector-bar)
- [Search Preview Pane](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/search-preview-pane)
- [Search Results Highlights](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/search-results-highlights)
- [Search With Recent](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/search-with-recent)
- [Sort Menu Blueprint](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/sort-menu-blueprint)
- [View Changes Bar](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/view-changes-bar)
- [Zero Results Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search/zero-results-panel)
