Blocks
Reference
Export map and type reference for @tulip-systems/blocks.
Server Entrypoint
import { ... } from "@tulip-systems/blocks";Exports:
createBlockRegistryresolveBlockSchemaresolveBlocksSchemaresolveBlockCreateSchemaresolveBlockDefinitionsortBlocksreindexBlocksgetNextBlockIndexappendBlockremoveBlockmoveBlockisBlockDataRecordpatchBlockData
Types:
BlockDefinitionAnyBlockDefinitionBlocksDefinitionBlocksRegistryBlockRegistryStoredBlockInferBlockFromDefinitionInferBlockInputFromDefinitionInferBlockInferBlockInputBlockComponentPropsBlockCreateComponentPropsInferBlockComponentsInferBlockCreateComponentsPatchBlockDataInputPatchBlockDataResultIndexedBlockBlockMoveResultBlockRemoveResult
Client Entrypoint
import { ... } from "@tulip-systems/blocks/client";Client exports include all server-safe contracts/helpers plus:
RenderBlocksRenderCreateBlocksCreateBlockCreateBlockTriggerCreateBlockTriggerIconCreateBlockTriggerContentCreateBlockTriggerTitleCreateBlockTriggerDescriptionCreateBlockContentCreateBlockHeaderCreateBlockTitleCreateBlockDescriptionCreateBlockFieldsCreateBlockFooterCreateBlockCancelCreateBlockSubmitSortableBlocksuseSortableBlockInlineBlockSortableuseInlineBlockSortableInlineBlockInlineBlockHeaderInlineBlockDragHandleInlineBlockTriggerInlineBlockContent
Stored Block Shape
type StoredBlock<TSlug extends string = string, TData = unknown> = {
id: string;
slug: TSlug;
index: number;
data: TData;
};Definition Shape
type BlockDefinition<TSlug extends string = string, TSchema extends z.ZodType = z.ZodType> = {
slug: TSlug;
label: string;
description?: string;
schema: TSchema;
};Common Gotchas
- Use
as const satisfies BlockDefinition; otherwise slugs may widen tostring. RenderBlocksrenders stored blocks. It does not render create options.RenderCreateBlocksrenders registry definitions. It does not need stored block data.- Keep create and inline mutations in the app so query keys, toasts, and permissions stay domain-specific.
patchDatavalidates the full merged data object, not just the patch.- If old database rows fail
selectSchema, add a migration or schema compatibility layer in the app. SortableBlocksdefaults to vertical sorting constrained to the parent element. Overridemodifiersorstrategyonly when the UI really differs.