regle

Core skills for using Regle form validation in Vue.js. Provides setup, validation rules, and usage patterns.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "regle" with this command: npx skills add victorgarciaesgi/regle/victorgarciaesgi-regle-regle

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
Built-in RulesAll validation rules from @regle/rulescore-built-in-rules
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

Rules

TopicDescriptionReference
Custom RulesInline rules, createRule, reactive parameters, async rules, metadatacore-custom-rules
Rule WrapperswithMessage, withParams, withAsync, withTooltip, chainingcore-rule-wrappers
Rule Operatorsand, or, xor, not, applyIf, assignIf, pipecore-rule-operators

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

regle-advanced

No summary provided by upstream source.

Repository SourceNeeds Review
General

vue

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

regle-typescript

No summary provided by upstream source.

Repository SourceNeeds Review
General

image-gen

Generate AI images from text prompts. Triggers on: "生成图片", "画一张", "AI图", "generate image", "配图", "create picture", "draw", "visualize", "generate an image".

Archived SourceRecently Updated