FieldTypeDef
A field type, as defineFieldType takes it.
Generics
TPropsextends AnyObjectSchema
Definition
FieldTypeDefkindValueKind | KindOf: the kind of its value, or a function of the field with its props parseditemKindValueKind | KindOf: optional, the kind of each item for kindarraypropsTProps: optional, the extra keys it takesschema(field: FieldWithProps, ctx: BuildContext) => AnySchema: the schema of its value. Required unless its kind isnonedefaultRulesreadonly JsonRule[]: optional, rules every field of the type getsrequired(message: string) => AnyAction | null: optional, replaces the kind's required checkfinalize(field: FieldWithProps) => AnyAction | undefined: optional, runs after every rulecontainerboolean: optional, true for a type whose value holds other fieldsmetaFieldTypeMeta: optional
Explanation
See custom field types.
FieldTypeMeta
FieldTypeMetalabelstringdescriptionstring: optional
FieldWithProps
ts
type FieldWithProps<TProps> = JsonField & InferOutput<TProps>A field with its type's props parsed and typed.
KindOf
A kind or itemKind that depends on the props: a select with number options has kind number.
ts
type KindOf<TProps> = (field: FieldWithProps<TProps>) => ValueKindBuildContext
BuildContextpathDefinitionPath: where the field is in the definitionbuildFields(fields: readonly JsonField[], path: DefinitionPath) => AnyObjectSchema: checks and builds child fieldsbuildField(field: JsonField, path: DefinitionPath) => AnySchema: checks and builds the field of a list's items
AnySchema, AnyAction, AnyObjectSchema
The Valibot schema and action types a field type works with: any schema, any action, and any object schema.