Composables Overview
All composables auto-imported by protokit — from the high-level usePrototype facade to the low-level Y.js primitives.
Composables Overview
All composables are auto-imported — no explicit import statement needed. For most use cases, usePrototype is the only composable you need. The lower-level composables are available for custom UI or fine-grained Y.js control.
Hierarchy
usePrototype ← high-level facade (start here)
├── useProtoDoc — Y.js document lifecycle (IndexedDB, server sync, corruption)
├── useProtoMap — Y.Map ↔ reactive refs bidirectional sync
├── useProtoList — Y.Array low-level CRUD
├── useProtoDerived — Reactive derived value computation
└── useProtoOutputs — Produces/consumes cross-tool wiring
useProtoCollection — High-level CRUD (wraps useProtoList + search + sort)
useProtoDraft — Draft persistence for modal item editors
useProtoCorruption — Corruption event queue and recovery
useProtoRegistry — Global schema registry
Quick reference
| Composable | Use when… |
|---|---|
usePrototype | You want everything at once — fields, derived, collections, reset, isReady |
useProtoDoc | You need direct access to the Y.Doc or sync state |
useProtoMap | You need Y.Map ↔ reactive refs sync with an existing doc |
useProtoList | You need raw Y.Array CRUD without schema awareness |
useProtoCollection | You need full CRUD with search, sort, count on an existing doc |
useProtoDerived | You need to compute derived values outside of usePrototype |
useProtoOutputs | You need to manually wire produces/consumes |
useProtoDraft | You are building a custom modal editor with draft support |
useProtoCorruption | You are building a custom corruption recovery UI |
useProtoRegistry | You need to look up schemas by key at runtime |
Detailed pages
usePrototype→ — full API, field refs, collections, scoping to a shared docuseProtoDoc→ — document cache, lifecycle, server sync,ClientOnlyrequirementuseProtoCollection→ — CRUD API, search, sort, max items
Visualizations & Layouts
Built-in visualization types (progress, bar chart, comparison table, feature matrix, timeline) and custom dashboard layouts with tabs, rows, and columns.
usePrototype
The high-level facade composable that combines document management, field sync, CRUD, derived computation, and cross-tool outputs into a single call.