Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

View Tabs

ProNew

Saved views of one table with counts, a gliding underline, and Save and Discard that appear when the view has changed.

Installation

pnpm dlx shadcn@latest add @viewport/view-tabs

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
views*View[]—
value*string

The id of the view in use.

—
onValueChange*(id: string) => void—
onCreate() => void

Adds a "New view" button.

—
dirtyboolean

The current view has filters or sorting that are not saved. Shows Save and Discard.

false
onSave() => void—
onDiscard() => void—
labelstring

Accessible name for the group.

"Views"
classNamestring—

Accessibility

  • A radio group, since every view shows the same table: arrow keys switch views.
  • Unsaved changes are announced, not only shown as a dot.
  • The hidden Save and Discard cannot be reached by Tab.
  • Respects prefers-reduced-motion.