mcpField
R
regle

regle

github.com/onmaxDevelopment723210 installsUpdated 3d ago
Repository

About regle

Regle is a type-safe, model-based form validation library for Vue 3, intended for teams building forms with TypeScript. It provides reactive validation and a headless API that can work with different UI frameworks and design systems.

Key features

  1. 01TypeScript-inferred validation
  2. 02Reactive values and errors
  3. 03Built-in and custom rules
  4. 04Schema integrations for Zod, Valibot, and ArkType
  5. 05Validation modifiers and groups

Use cases

  1. 01Validate reactive Vue form state
  2. 02Display field-level errors and dirty state
  3. 03Apply asynchronous or conditional rules
  4. 04Integrate schema-based validation

MCP support

Regle provides an MCP server for accessing its documentation and autocomplete. MCP clients can launch it with `npx @regle/mcp-server`.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/onmax/nuxt-skills --skill regle

After installing, type/reglein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
core-displaying-errors.md
core-modifiers.md
core-use-regle.md
core-validation-properties.md

Details

From the project README

Regle

Regle is a type-safe, model-based, headless form validation library for Vue 3. It provides full TypeScript inference, reactive validation, and works with any UI framework or design system.

MCP Server

Regle provides an MCP server that can be used to get documentation and autocomplete for Regle. If it's available, use it to get up-to-date information on the API.

{
  "mcpServers": {
    "regle": {
      "command": "npx",
      "args": ["@regle/mcp-server"]
    }
  }
}

## Installation

```sh
# Core + built-in rules
pnpm add @regle/core @regle/rules

# Optional: schema support (Zod, Valibot, ArkType)
pnpm add @regle/schemas

Requires Vue 3.3+ and TypeScript 5.1+.

Quick Start

import { useRegle } from '@regle/core';
import { required, email, minLength } from '@regle/rules';

const { r$ } = useRegle(
  { name: '', email: '' },
  {
    name: { required, minLength: minLength(3) },
    email: { required, email },
  }
);
<template>
  <input v-model="r$.$value.name" placeholder="Name" />
  <ul v-if="r$.$errors.name.length">
    <li v-for="error of r$.$errors.name" :key="error">{{ error }}</li>
  </ul>

  <button @click="r$.$validate()">Submit</button>
</template>

Key Concepts

  • State: first argument -- raw object, reactive, ref, or single value
  • Rules: second argument -- mirrors the data structure, each field gets a rules object
  • r$: returned reactive object with values, errors, dirty state, and validation methods
  • All rules are optional by default; add required to enforce a field

Core

TopicDescriptionReference
useRegleState definition, rules declaration, dynamic rules, r$ objectcore-use-regle
Validation Properties$invalid, $dirty, $error, $errors, $pending, $validate, $touch, $resetcore-validation-properties
Displaying ErrorsShowing errors, custom messages, getErrors, flatErrorscore-displaying-errors
ModifiersautoDirty, lazy, silent, rewardEarly, disabled, validationGroups, per-field modifierscore-modifiers

Related skills

  • regle-rules — built-in rules, custom rules (createRule), rule wrappers (withMessage, withParams, withAsync), and rule operators (and, or, applyIf, assignIf).
  • regle-advanced — collections, async, server errors, reset, scoped validation, variants, global config.
  • regle-schemas — Zod, Valibot, ArkType, and Standard Schema integration.
  • regle-typescript — type-safe output, typing rules schemas and component props.

Comments

Markdown supported