🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@expeed/ngx-schema-editor

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expeed/ngx-schema-editor

Visual JSON Schema editor for Angular - create and edit schemas for dynamic form rendering

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

@expeed/ngx-schema-editor

A visual JSON Schema editor component for Angular applications. Create and edit JSON Schema definitions with a drag-and-drop interface.

Features

  • Visual schema builder with drag-and-drop field reordering
  • Support for all JSON Schema types: string, number, integer, boolean, object, array
  • Nested object and array structures
  • Field validators (minLength, maxLength, pattern, minimum, maximum, format)
  • Enum values with optional display labels
  • Display type hints (x-display-type) for form rendering
  • Required field toggle
  • Indent/outdent to restructure hierarchy
  • Toggle between visual editor and raw JSON view
  • Outputs valid JSON Schema (draft 2020-12)

Installation

npm install @expeed/ngx-schema-editor

Peer Dependencies

npm install @angular/cdk @angular/material

Usage

Basic Usage

import { Component } from '@angular/core';
import { SchemaEditorComponent, JsonSchema } from '@expeed/ngx-schema-editor';

@Component({
  selector: 'app-schema-page',
  standalone: true,
  imports: [SchemaEditorComponent],
  template: `
    <schema-editor
      [schema]="schema"
      (schemaChange)="onSchemaChange($event)"
    />
  `
})
export class SchemaPageComponent {
  schema: JsonSchema = {
    type: 'object',
    title: 'Customer',
    properties: {}
  };

  onSchemaChange(updated: JsonSchema): void {
    console.log('Schema updated:', updated);
    this.schema = updated;
  }
}

With Initial Schema

schema: JsonSchema = {
  type: 'object',
  title: 'Customer',
  properties: {
    firstName: {
      type: 'string',
      title: 'First Name',
      minLength: 1,
      maxLength: 50
    },
    email: {
      type: 'string',
      title: 'Email',
      format: 'email'  // Form renderer auto-infers email input type
    },
    age: {
      type: 'integer',
      title: 'Age',
      minimum: 0,
      maximum: 150
    },
    status: {
      type: 'string',
      title: 'Status',
      oneOf: [
        { const: 'active', title: 'Active' },
        { const: 'inactive', title: 'Inactive' }
      ],
      'x-display-type': 'dropdown'
    }
  },
  required: ['firstName', 'email']
};

API Reference

SchemaEditorComponent

Inputs

InputTypeDefaultDescription
schemaJsonSchema{}The JSON Schema to edit

Outputs

OutputTypeDescription
schemaChangeEventEmitter<JsonSchema>Emits when schema changes

JsonSchema Interface

interface JsonSchema {
  type?: string;
  title?: string;
  description?: string;
  properties?: Record<string, JsonSchema>;
  items?: JsonSchema;
  required?: string[];
  enum?: unknown[];
  oneOf?: Array<{ const: unknown; title?: string }>;
  minimum?: number;
  maximum?: number;
  minLength?: number;
  maxLength?: number;
  pattern?: string;
  format?: string;
  default?: unknown;
  'x-display-type'?: string;
}

Supported Field Types

TypeDescription
stringText values
numberDecimal numbers
integerWhole numbers
booleanTrue/false values
objectNested object with properties
arrayArray of items

Display Types (x-display-type)

The editor supports the x-display-type extension property to hint how fields should be rendered in forms:

Display TypeField TypeDescription
textboxStringSingle-line text input
textareaStringMulti-line text input
richtextStringRich text editor (HTML)
dropdownString (enum)Select dropdown
radioString (enum)Radio button group
datepickerDateDate picker
datetimepickerDateDate and time picker
timepickerTimeTime picker
stepperNumberNumber stepper with +/- buttons
checkboxBooleanCheckbox
toggleBooleanToggle switch
multiselectArray (enum)Checkbox group for multiple selection
multiselect-dropdownArray (enum)Dropdown with checkboxes for multiple selection
tagsArray (string)Tag input for string arrays

Note: Email and URL fields use format (email, uri) in JSON Schema. The form renderer auto-infers the appropriate input type from the format.

Validators

Configure field validation constraints:

ValidatorApplies ToDescription
minLengthstringMinimum character length
maxLengthstringMaximum character length
patternstringRegex pattern
formatstringBuilt-in format (email, uri, date, etc.)
minimumnumber/integerMinimum value
maximumnumber/integerMaximum value

Enum Values

Define allowed values with optional display labels:

// Simple enum
{
  type: 'string',
  enum: ['small', 'medium', 'large']
}

// Enum with labels (using oneOf)
{
  type: 'string',
  oneOf: [
    { const: 'sm', title: 'Small' },
    { const: 'md', title: 'Medium' },
    { const: 'lg', title: 'Large' }
  ]
}

Styling

The component uses Angular Material and can be themed using CSS custom properties:

schema-editor {
  --se-bg: #ffffff;
  --se-border: #e2e8f0;
  --se-text-primary: #1e293b;
  --se-text-secondary: #64748b;
  --se-accent: #6366f1;
}

Exports

// Components
export { SchemaEditorComponent } from './lib/components/schema-editor/schema-editor.component';

// Types
export { JsonSchema } from './lib/models/json-schema.model';
export { LabeledValue } from './lib/models/labeled-value.model';

// Utilities
export { isLabeledValue, getRawValue, getDisplayText } from './lib/utils/allowed-value.utils';

Requirements

  • Angular 21+
  • Angular Material 21+
  • Angular CDK 21+

License

Apache 2.0

Keywords

angular

FAQs

Package last updated on 17 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts