Skip to content
synccn

DataView

New

Data table for real apps: resizable and hideable columns, selection with bulk actions, saved views, server mode, and loading, empty and error states.

Email
MSMichael Stonemichael.stone@example.comFreeActive$0
RLRiley Linriley.lin@example.comEnterpriseActive$600
JIJayden Ibarrajayden.ibarra@example.comProActive$87
APAvery Parkavery.park@example.comProActive$116
JOJordan Okaforjordan.okafor@example.comFreeActive$0
CSCasey Shahcasey.shah@example.comEnterpriseActive$1,080
MRMorgan Reyesmorgan.reyes@example.comProActive$87
QNQuinn Novakquinn.novak@example.comProActive$116
HSHarper Stoneharper.stone@example.comFreeActive$0
RLRowan Linrowan.lin@example.comEnterpriseActive$840
1–10 of 64

Installation

$ pnpm dlx shadcn@latest add @synccn/data-view

First time in this project? Connect synccn with one command.

Usage

import { DataView } from "@/components/ui/data-view";<DataView columns={columns} data={rows} rowKey={(r) => r.id} selectable bulkActions={(rows) => …} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

DataView

Data table for real apps: search, sort, column visibility and resizing, selection with bulk actions, saved views, and loading, empty and error states. Works on local data or as a view over a server (mode="server").

  • columnsrequired
    DataViewColumn<T>[]

    Column definitions.

  • datarequired
    T[]

    Rows. In server mode, only the current page.

  • rowKeyrequired
    (row: T) => string

    Stable id for each row (selection survives sorting and paging).

  • mode
    "client" | "server"

    Default "client"

    "client" sorts, searches and pages `data` itself; "server" reports state changes and shows `data` as is.

  • rowCount
    number

    Total rows on the server (server mode).

  • onStateChange
    (state: DataViewState) => void

    Called whenever search, sort, page or page size change. Fetch here in server mode.

  • filter
    (row: T) => boolean

    Extra filter applied before search (client mode), e.g. from a FilterBuilder.

  • loading
    boolean

    Default false

    Show skeleton rows.

  • error
    React.ReactNode

    Show an error with a retry button.

  • onRetry
    () => void

    Called by the retry button.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Components

Helpers

npm packages

Keyboard

  • TabMove between the toolbar, headers, resize handles and rows
  • EnterOpen the focused row (when rows are clickable)
  • ←or→Resize the column whose handle is focused

Accessibility

  • Sortable headers are buttons and the table reports the sort with aria-sort.
  • Selection checkboxes have labels; the header checkbox shows a mixed state when some rows on the page are selected.
  • The row count is announced politely as you page, search and filter; loading sets aria-busy.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: alert, group, separator, toolbar
  • ARIA attributes: aria-busy, aria-label, aria-live, aria-orientation, aria-pressed, aria-selected, aria-sort
  • Keys handled: ArrowLeft, ArrowRight, Enter, Escape
  • Shows a visible focus ring for keyboard users
  • Announces changes to screen readers