Data Table Sort
<zn-data-table-sort>
ZnDataTableSort
Data table sorts let users pick the field and direction a data table is sorted by.
<zn-data-table-sort></zn-data-table-sort>
Examples
Basic Usage
The data table sort component provides a dropdown interface for sorting data.
<zn-data-table-sort></zn-data-table-sort>
In Table Header
Typically used in data table headers for sorting functionality.
Product List
<div style="display: flex; gap: 10px; align-items: center;"> <span>Product List</span> <zn-data-table-sort></zn-data-table-sort> </div>
With Action Bar
Combine with other table controls in an action bar.
<zn-action-bar> <zn-button slot="menu" color="transparent">All Items</zn-button> <zn-button slot="menu" color="transparent">Active</zn-button> <zn-button slot="menu" color="transparent">Archived</zn-button> <zn-data-table-sort slot="actions"></zn-data-table-sort> <zn-button slot="actions" icon="filter_alt" color="transparent"></zn-button> <zn-button slot="actions" icon="refresh" color="transparent"></zn-button> </zn-action-bar>
Multiple Sort Controls
Use multiple sort controls for different sections or views.
Customer List
Order History
Product Inventory
<div class="form-spacing"> <div> <h4>Customer List</h4> <zn-data-table-sort></zn-data-table-sort> </div> <div> <h4>Order History</h4> <zn-data-table-sort></zn-data-table-sort> </div> <div> <h4>Product Inventory</h4> <zn-data-table-sort></zn-data-table-sort> </div> </div>
Compact Layout
The component automatically uses a compact size suitable for table headers.
Results (123)
<div style="display: flex; align-items: center; padding: 10px; background: var(--zn-color-neutral-50); border-radius: 4px;"> <span style="font-weight: bold; margin-right: auto;">Results (123)</span> <zn-data-table-sort></zn-data-table-sort> </div>