From fdd5f6787401de999e73f8e264ebe5c0c9936137 Mon Sep 17 00:00:00 2001 From: ypreiser Date: Tue, 9 Apr 2024 21:00:47 +0300 Subject: [PATCH] added regex example to readme --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index 7f1d4f8e..e7b00eb2 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,40 @@ const fields = [ }, ], }, + { + // Visible in table header and when matching columns. + label: "Age", + // This is the key used for this field when we call onSubmit. + key: "age", + // Allows for better automatic column matching. Optional. + alternateMatches: ["years old"], + // Used when editing and validating information. + fieldType: { + // There are 3 types - "input" / "checkbox" / "select". + type: "input", + }, + // Used in the first step to provide an example of what data is expected in this field. Optional. + example: "23", + // Can have multiple validations that are visible in Validation Step table. + validations: [ + { + // Can be "required" / "unique" / "regex" + rule: "regex", + value: "^[0-9]*$", + errorMessage: "Age should be a number", + // There can be "info" / "warning" / "error" levels. Optional. Default "error". + level: "warning", + }, + { + // Can be "required" / "unique" / "regex" + rule: "required", + errorMessage: "Age is required", + // There can be "info" / "warning" / "error" levels. Optional. Default "error". + level: "error", + }, + + ], + }, ] as const ```