Rule properties
Rule properties are computed values or methods available in every nested rule status (including regle)
Let's take a look at a simple example to explain the different properties.
<script setup lang='ts'>
import { } from '@regle/core';
import { } from '@regle/rules';
import { } from 'vue';
const = ({ : '', : { : '', : '' } });
const { } = (, {
: { },
: {
: { },
}
})
....
</script>
<template>
< v-model='..' ='Type your firstName'/>
<>
< v-for=" of ..." =''>
{{ }}
</>
</>
</template>Computed properties for rules
$valid
- Type:
readonly boolean
Indicates the state of validation for this validator.
$pending
- Type:
readonly boolean
If the rule is async, indicates if it's currently pending. Always false if it's synchronous.
$message
- Type:
readonly string | string[]
Returns the computed error message or messages for the current rule.
$active
- Type:
readonly boolean
Indicates whether or not the rule is enabled (for rules like requiredIf)
$metadata
- Type
RegleRuleMetadataDefinition
Contains the metadata returned by the validator function.
$type
- Type:
readonly string
The name of the rule type.
$validator
- Type:
readonly (value, ...metadata) => boolean | {$valid: true, [x:string]: any}
Returns the original rule validator function.
$path
- Type:
readonly string[]
Returns the current path of the rule (used internally for tracking)
Common methods for rules
$parse
- Type:
() => Promise<boolean>
Run the rule validator and compute its properties like $message and $active
$reset
- Type:
() => void
Reset the $valid, $metadata and $pending states

