Editable List

Editable List

Data Display
Forms

Interactive list with checkable items, inline editing, drag-and-drop reordering, and action menus.

Preview

Checkable list with inline editing - double-click to edit, hover for actions

  • Review design mockups
  • Update component library
  • Write documentation

Drag & Drop Reordering

Enable reorderable to drag items to new positions

  • High priority task
  • Medium priority task
  • Low priority task

Without Checkboxes

Simple list without completion tracking

  • First item
  • Second item
  • Third item

Read-Only Mode

Checkable but not editable

  • Read-only item 1
  • Read-only item 2
  • Read-only item 3

Custom Actions

Add custom action buttons to the menu

  • Feature request
  • Bug report
  • Enhancement

Empty State

Custom message when list is empty

No tasks yet. Add one to get started!

Props

EditableList component API reference

PropTypeDefaultDescription
itemsEditableListItem[]—Array of list items (required)
onChange(items: EditableListItem[]) => void—Called when items change
onItemToggle(item: EditableListItem) => void—Called when item is checked/unchecked
onItemEdit(item, newText) => void—Called when item text is edited
onItemDelete(item: EditableListItem) => void—Called when item is deleted
actionsEditableListAction[]—Custom action menu items
reorderablebooleanfalseEnable drag-and-drop reordering
checkablebooleantrueShow checkboxes
editablebooleantrueEnable inline editing
emptyMessagestring—Message shown when list is empty
classNamestring—Additional CSS classes

EditableListItem Type

PropTypeDefaultDescription
idstring | number—Unique identifier (required)
textstring—Item text content (required)
completedboolean—Whether item is checked
editableboolean—Override editability per item

Usage

Import and implementation example

import { EditableList, EditableListItem } from '@/blocks/data-display/editable-list'
import { Star } from 'lucide-react'
export default function Example() {
const [items, setItems] = useState<EditableListItem[]>([
{ id: 1, text: 'Task 1', completed: false },
{ id: 2, text: 'Task 2', completed: true },
])
return (
<>
{/* Basic editable list */}
<EditableList
items={items}
onChange={setItems}
onItemDelete={(item) => console.log('Deleted:', item)}
/>
{/* With drag-and-drop reordering */}
<EditableList
items={items}
onChange={setItems}
reorderable
/>
{/* Without checkboxes */}
<EditableList
items={items}
onChange={setItems}
checkable={false}
/>
{/* Read-only (no editing) */}
<EditableList
items={items}
onChange={setItems}
editable={false}
/>
{/* With custom actions */}
<EditableList
items={items}
onChange={setItems}
actions={[
{
label: 'Star',
icon: <Star className="w-4 h-4" />,
onClick: (item) => console.log('Starred:', item),
},
]}
/>
{/* Custom empty message */}
<EditableList
items={[]}
emptyMessage="No items yet"
/>
</>
)
}

Features

Built-in functionality

  • Checkable items: Track completion with styled checkboxes
  • Inline editing: Double-click to edit, Enter to save, Escape to cancel
  • Drag and drop: Reorder items with native HTML5 drag-and-drop
  • Actions menu: Built-in edit/delete plus custom actions
  • Hover effects: Show actions and drag handle on hover
  • Strikethrough: Completed items show with strikethrough text
  • Empty state: Custom message when no items

Accessibility

Accessibility considerations

ARIA Attributes

Uses semantic list elementsCheckbox has proper labelingDrag handle is keyboard accessible

Keyboard Navigation

KeyAction
TabNavigate between items
SpaceToggle checkbox
EnterSave edit / Activate action
EscapeCancel edit
Double-clickStart editing

Notes

  • Focus management during edit mode
  • Drag operations announced to screen readers
  • Delete confirmation for destructive actions