Generic List

Schema-aware list system with selection, keyboard navigation, and accessible defaults.

Quickstart

  1. Ensure the registry is set up in Installation.
  2. Run the registry command:
npx shadcn@latest add https://gen-ui-eta-two.vercel.app/r/generic-list

Features

  • Schema-Based: Define primary, secondary, meta, and trailing fields.
  • Selection: Single or multi-select with built-in checkboxes.
  • Keyboard Navigation: Arrow key navigation with selection support.
  • Variants: Default, card, compact, and separated styles.
  • Empty/Loading States: Defaults included, override as needed.

Basic Usage

import { GenericList } from "@/components/systems/generic-list/generic-list"

const schema = {
  primary: "name",
  secondary: "email",
  avatar: "avatarUrl",
  trailing: { key: "status", type: "badge" },
}

<GenericList
  data={users}
  schema={schema}
  selectable="multiple"
  onItemClick={(user) => console.log(user)}
/>

Custom Field Rendering

Use field render to customize output per field.

const schema = {
  primary: {
    key: "name",
    render: (value) => <strong>{String(value)}</strong>,
  },
  secondary: "email",
  meta: [{ key: "lastSeen", type: "date" }],
}

API Reference

PropTypeNotes
dataT[]Items must include id
schemaListSchemaPrimary/secondary/meta mapping
selectable"none" | "single" | "multiple"Selection mode
variant"default" | "card" | "compact" | "separated"Visual style
dividersbooleanShow separators
renderItem(props) => ReactNodeCustom item renderer
virtualized / estimatedItemHeightboolean / numberReserved for future support
← Previous: Generic GridNext: Action System