Skip to main content

Equals

This validator let's you ensure that one value is exactly equal to another value.

Example

import React from "react";
import {
createForm,
pageBreak,
textField,
StatefulFormView,
content,
equals,
} from "@fab4m/fab4m";
import "@fab4m/fab4m/css/basic/basic.css";

const form = createForm({
city: textField({
label: "City",
validators: [equals("Gothenburg", "The city must be Gothenburg")],
required: true,
}),
break: pageBreak(),
content: content({}, () => <div>Great choice!</div>),
});

export default function TextFieldExample() {
return <StatefulFormView form={form} hideSubmit={true} />;
}

Compatible components