Skip to content

Text

Interface

export type ITextTypeValue = string;
 
export interface ITextField extends CommonField {
    type: 'text';
    options?: {
        placeholder?: string;
    };
    private?: () => Promise<ITextTypeValue>;
    render?: (v: ITextTypeValue) => JSX.Element;
    validation?: Validation<ITextTypeValue>;
}

Example

Basic Text Field

{
  type: 'text',
  name: 'YOUR_PATH',
  validation: z.string()
}

Email validation

  {
    type: 'text',
    name: 'YOUR_PATH',
    options: {
      placeholder: 'Enter your email'
    },
    validation: z.email({ message: 'Invalid email address' })
  }

URL Validation

{
    type: 'text',
    name: 'YOUR_PATH',
    options: {
      placeholder: 'Enter your url'
    },
    validation: z.url({ message: 'Invalid URL' })
  },