View as Markdown

API reference: @salmonui/core/validation

CustomValidatortype

import type { CustomValidator } from '@salmonui/core/validation';
type CustomValidator<Row = unknown, Ctx = ValidatorContext<Row>> = (value: unknown, row: Row, ctx: Ctx) => string | boolean | null | undefined | PromiseLike<string | boolean | null | undefined>;

Custom validator: returns an error message, or null / undefined / true when the value is valid (false uses the rule message). May return a promise (async validation): commit waits for it.