Skip to main content
Version: v6.8.1

messages

Messages

We've gathered all the validation message in to src/config/messages.tsx file. You can add your own validation messages and updated existing message from this file.

src/config/messages.tsx
export const messages = {
emailIsRequired: 'Email address is required',
invalidEmail: 'Invalid email address',
passwordRequired: 'Password is required',
passwordLengthMin: 'Password must be at least 6 characters',
nameIsRequired: 'Name is required',
// More messages...
};

Usage

src/utils/common-rules.ts
import { z } from 'zod';
import { messages } from '@/config/messages';

export const validateEmail = z.string().min(1, { message: messages.emailIsRequired }).email({ message: messages.invalidEmail });