> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Email

Schema type reference for the email type.

A string which represents an email address. Every `email` field checks that its value is a valid email address, with no validation configuration needed. See the [EmailDefinition](https://reference.sanity.io/sanity/index/EmailDefinition/) reference for the full type definition.

## Properties

#### Properties

**type** (required)

Value must be set to email.

**name** (required)

The field name. This becomes the key in the document.

**title**

Human-readable label for the field.

**hidden**

If set to true, this field is hidden in the studio. You can also supply a callback function to make it a conditional field.

**readOnly**

If set to true, this field is not editable in the studio. You can also supply a callback function to make it a conditional field.

**description**

Short description for editors of how the field is to be used.

**initialValue**

The initial value used when creating new values of this type. Can be a literal value, or a resolver function that returns a literal value or a promise that resolves to one.

**components**

Lets you provide custom components to override the studio defaults in various contexts. The available keys are diff, field, input, item, and preview.

**deprecated**

Marks a field or document type as deprecated in the studio interface and displays a user-defined message set through the single required reason property.

If you deploy a GraphQL API schema, this property is translated into the @deprecated directive.

**icon**

Supply a custom icon for this field. See the icons documentation for more information.

**placeholder**

Placeholder text shown in the input when it has no value.

## Options

The `email` type has no options of its own. Only the shared options below apply. See the [EmailOptions](https://reference.sanity.io/sanity/index/EmailOptions/) reference for the full type definition.

#### Properties

**sanityCreate**

Configures how Sanity Create interfaces with this field. Set exclude: true to leave the field out of Sanity Create, or purpose to describe what the field holds so that content mapping can use it.

**canvasApp**

Configures how Canvas interfaces with this field. Takes the same exclude and purpose properties as sanityCreate.

## Validation

Every `email` field is validated as an email address even when you set no `validation` of your own. An invalid value fails with `Must be a valid email address`. Rules you chain are added to that check rather than replacing it, so `rule.required()` enforces presence and format together. Only `skip()` removes the format check. See the [EmailRule](https://reference.sanity.io/sanity/index/EmailRule/) reference for the full type definition.

#### Properties

**required()**

Ensures that this field exists.

**skip()**

Discards the validation rules set before it in the chain and makes the field optional. Rules chained after it still apply.

**custom(fn)**

Creates a custom validation rule.

**error(message)**

Sets a custom error message for the preceding validation rule.

**warning(message)**

Sets a custom warning message for the preceding validation rule. Warnings do not prevent publishing.

**info(message)**

Sets a custom info message for the preceding validation rule. Info messages are purely informational and do not prevent publishing.

**valueOfField(path)**

Gets the value of a sibling field to use in validation. Useful for creating validation rules that depend on the value of another field.

> [!NOTE]
> The email type and the email() validation rule are different things
> This page covers `email` as a schema type. There is also an `email()` validation rule, available on the [string](https://www.sanity.io/docs/studio/string-type) and [text](https://www.sanity.io/docs/studio/text-type) types. A field of type `email` applies that check for you, and `EmailRule` has no `email()` method to chain. Use `string` with `email()` when you need the format check on a field that is otherwise an ordinary string.

The `email` type stores a string and renders a single-line text input. That input always carries `type="email"` and `inputMode="email"`, so the browser applies its own email validation and mobile keyboards show the email layout.

```html
<input type="email" inputmode="email">
```

Input

**schemaTypes/author.ts**

```typescript
import {defineField, defineType} from 'sanity'

export const author = defineType({
  name: 'author',
  type: 'document',
  fields: [
    defineField({
      name: 'contactEmail',
      title: 'Contact email',
      type: 'email',
    }),
  ],
})
```

Response

```json
{
  "_type": "author",
  "contactEmail": "editor@example.com",
  ...
}
```

To make an email address mandatory and hint at the expected format, combine `required()` with `placeholder`:

**Required with a placeholder**

```typescript
defineField({
  name: 'contactEmail',
  title: 'Contact email',
  type: 'email',
  placeholder: 'editor@example.com',
  validation: (rule) => rule.required(),
})
```

**Optional, format check removed**

```typescript
defineField({
  name: 'contactEmail',
  title: 'Contact email',
  type: 'email',
  validation: (rule) => rule.skip(),
})
```

