Skip to content

UI Components API Reference

@banclo/jsonforms-ui provides the visual builder components. The package exports Vue 3 single-file components styled with Tailwind CSS and the shadcn-vue design system.

FormBuilder

The main component that renders the complete three-panel builder interface.

Props

PropTypeDefaultDescription
modelValueFormBuilderOutputundefinedOptional v-model binding for the output schemas
previewAdapterstring'jsonforms-vue-vanilla'Which preview adapter to use for live preview

Events

EventPayloadDescription
update:modelValueFormBuilderOutputEmitted when the generated schemas change

FormBuilderOutput

ts
interface FormBuilderOutput {
  jsonSchema: Record<string, unknown>
  uiSchema: Record<string, unknown>
}

Slots

The FormBuilder component does not expose named slots. Customization is done through CSS (see Theming) and by configuring the stores.

Usage

vue
<script setup lang="ts">
import { ref } from 'vue'
import { FormBuilder, type FormBuilderOutput } from '@banclo/jsonforms-ui'

const output = ref<FormBuilderOutput>()
</script>

<template>
  <div style="height: 100vh">
    <FormBuilder v-model="output" />
  </div>
</template>

Layout

The component renders a CSS Grid with three columns:

[ComponentPalette (280px)] [BuilderToolbar + BuilderCanvas (1fr)] [PropertyPanel (320px)]

The builder must be given a height (e.g., height: 100vh or flex: 1 in a flex container) since it fills its container with h-full.

Responsive Behavior

At viewport widths below 768px, the three-column layout collapses to two columns. The PropertyPanel is hidden from the grid and instead rendered as a slide-over panel that appears from the right edge when a node is selected. This keeps the palette and canvas usable on smaller screens without sacrificing access to property editing.

FormBuilderProvider

A wrapper component that provides the component registry to the builder via Vue's provide/inject. Use this when you need to customize the registry before the builder mounts.

vue
<template>
  <FormBuilderProvider :registry="myRegistry">
    <FormBuilder />
  </FormBuilderProvider>
</template>

ComponentPalette

The left panel showing draggable components organized by category.

Behavior

  • Groups components by their manifest category field
  • Provides a search input that filters by component name and category
  • Each item is a drag source with data-manifest-id set to the manifest ID
  • Items are rendered by PaletteGroup and PaletteItem sub-components

CSS Classes

ClassElement
.bg-cardPanel background
.border-r.border-borderRight border
.text-sm.font-semibold"Components" heading

Sub-components

PaletteGroup

Renders a collapsible group of palette items with a category header.

Props:

PropTypeDescription
titlestringCategory name displayed as the group header
manifestsComponentManifest[]Manifests in this category

PaletteItem

Renders a single draggable palette item.

Props:

PropTypeDescription
manifestComponentManifestThe manifest for this palette entry

Data Attributes:

AttributeValueDescription
data-manifest-idManifest ID stringUsed by drag handlers to identify what is being dragged

BuilderCanvas

The central area where the form layout is visually constructed.

Behavior

  • Uses vue-draggable-plus (VueDraggable) for drag-and-drop
  • Renders the root node's children as CanvasNode components
  • Shows an empty state with a drop indicator when no elements are present
  • Clicking the canvas background deselects the current node

CSS Classes

ClassElement
.builder-canvasCanvas container
.bg-backgroundCanvas background
.border-2.border-dashed.border-borderEmpty state drop zone

Sub-components

CanvasNode

Renders a single node on the canvas with selection highlighting, hover effects, and nested drag-drop zones for layout nodes.

Props:

PropTypeDescription
nodeSchemaNodeThe node to render
depthnumberNesting depth for indentation

Data Attributes:

AttributeValue
data-node-typeThe node's type (e.g., "HorizontalLayout", "Control")
data-canvas-nodePresent on all canvas nodes

CanvasDropZone

Renders a drop target indicator between or inside canvas nodes.

BuilderToolbar

The toolbar above the canvas with common actions.

Actions

  • Undo -- calls store.undo()
  • Redo -- calls store.redo()
  • Delete -- removes the selected node
  • Duplicate -- duplicates the selected node
  • Export -- exports the current JSON Schema and UI Schema

ImportModal

A dialog component triggered from the toolbar that allows importing existing JSON Schema and UI Schema definitions into the builder. It accepts pasted JSON and validates the input before applying it.

Props:

PropTypeDefaultDescription
openbooleanfalseControls visibility of the modal

Events:

EventPayloadDescription
update:openbooleanEmitted when the modal requests to close
import{ jsonSchema: object, uiSchema: object }Emitted with the parsed schemas on successful import

PropertyPanel

The right panel for editing the selected node's properties.

Behavior

  • Shows a placeholder message when no node is selected
  • Displays the node type and a form for editing properties:
    • Label -- text input for the node label
    • Property Name -- text input for the JSON Schema property name (controls only)
    • Schema Type -- dropdown for the JSON Schema type (controls only)
    • Validation -- constraint editors (minLength, maximum, pattern, etc.)
    • Options -- key-value editor for UI Schema options
    • Rules -- rule editor for conditional visibility

Tabs

The property panel organizes editors into tabs:

TabContents
PropertiesLabel, property name, schema type
ValidationType-specific constraints (string, number, array, object)
RulesRule effect and condition editors
JSONRaw JSON view of the node

Composables

useKeyboardShortcuts

Registers global keyboard shortcuts for the builder. Called automatically by FormBuilder.

ShortcutAction
Ctrl+Z / Cmd+ZUndo
Ctrl+Shift+Z / Cmd+Shift+ZRedo
Ctrl+Y / Cmd+YRedo (alternative)
Delete / BackspaceDelete selected node
Ctrl+D / Cmd+DDuplicate selected node
Ctrl+C / Cmd+CCopy selected node
Ctrl+X / Cmd+XCut selected node
Ctrl+V / Cmd+VPaste clipboard content
EscapeDeselect

useDragDrop

Provides drag-and-drop event handlers used by BuilderCanvas and CanvasNode.

ts
const { onDragAdd, onDragUpdate, onMoveNode } = useDragDrop()
FunctionDescription
onDragAdd(manifestId, parentId, index)Handle a new item dropped from the palette
onDragUpdate(parentId, oldIndex, newIndex)Handle reordering within a parent
onMoveNode(nodeId, newParentId, newIndex)Move an existing node to a different parent and position

Return type:

ts
interface DragDropReturn {
  onDragAdd: (manifestId: string, parentId: string, index: number) => void
  onDragUpdate: (parentId: string, oldIndex: number, newIndex: number) => void
  onMoveNode: (nodeId: string, newParentId: string, newIndex: number) => void
}