Skip to main content
Light Dark System

Data Table Sort

<zn-data-table-sort> | ZnDataTableSort
Since 1.0 experimental

Short summary of the component’s intended use.

<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.

All Items Active Archived
<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>

Importing

If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.

To import this component from the CDN using a script tag:

<script type="module" src="https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.86/dist/components/data-table-sort/data-table-sort.js"></script>

To import this component from the CDN using a JavaScript import:

import 'https://cdn.jsdelivr.net/npm/@kubex/zinc@1.0.86/dist/components/data-table-sort/data-table-sort.js';

To import this component using a bundler:

import '@kubex/zinc/dist/components/data-table-sort/data-table-sort.js';

Slots

Name Description
(default) The default slot.
example An example slot.

Learn more about using slots.

Events

Name React Event Description Event Detail
zn-event-name Emitted as an example. -

Learn more about events.

Custom Properties

Name Description Default
--example An example CSS custom property.

Learn more about customizing CSS custom properties.

Parts

Name Description
base The component’s base wrapper.

Learn more about customizing CSS parts.

Dependencies

This component automatically imports the following dependencies.

  • <zn-example>