Skip to main content
<List> is a compound component for rendering lists with built-in animation and drag-sort support. It works with .map() children to preserve VertzQL field selection.

Basic Usage

Animation

Enable FLIP animations for enter, exit, and reorder transitions:
New items get data-presence="enter", removed items get data-presence="exit". Use CSS to define enter/exit animations:

Custom Animation Config

prefers-reduced-motion is automatically respected. When the user prefers reduced motion, FLIP reorder animations are skipped.

Drag-and-Sort

Enable drag reordering with sortable and onReorder:
When sortable is true:
  • <List.DragHandle> elements initiate drag on pointerdown
  • If no <List.DragHandle> is present, the entire <List.Item> acts as the drag handle
  • onReorder(fromIndex, toIndex) is called on drop
  • The dragged item receives data-dragging during drag

Sub-components

List.Item

Renders an <li> element with optional class distribution from the theme.

List.DragHandle

Renders a drag handle element inside a <List.Item>. Only active when sortable is true.

Props

List (root)

PropTypeDefaultDescription
classesListClassesClass distribution for root, item, dragHandle
classNamestringClass for the root <ul> element
animateboolean | AnimateConfigfalseEnable FLIP animations
sortablebooleanfalseEnable drag-and-sort
onReorder(from: number, to: number) => voidCalled when an item is dragged to a new position

AnimateConfig

PropTypeDefaultDescription
durationnumber200FLIP animation duration in ms
easingstring'ease-out'CSS easing function

List.Item / List.DragHandle

PropTypeDescription
childrenChildValueContent
classNamestringAdditional CSS class

Theming

With @vertz/theme-shadcn, List is automatically styled. The theme provides classes for root, item, and dragHandle slots: