---
title: symbol
description: Creates a symbol schema.
source: /schemas/symbol/symbol.ts
contributors:
  - fabian-hiller
  - wout-junius
---

import { ApiList, Property } from '~/components';
import { properties } from './properties';

# symbol

Creates a symbol schema.

```ts
const Schema = v.symbol<TMessage>(message);
```

## Generics

- `TMessage` <Property {...properties.TMessage} />

## Parameters

- `message` <Property {...properties.message} />

### Explanation

With `symbol` you can validate the data type of the input. If it is not a symbol, you can use `message` to customize the error message.

## Returns

- `Schema` <Property {...properties.Schema} />

## Examples

The following examples show how `symbol` can be used.

### Custom message

Symbol schema with a custom error message.

```ts
const schema = v.symbol('A symbol is required');
```

## Related

The following APIs can be combined with `symbol`.

### Schemas

<ApiList
  items={[
    'array',
    'exactOptional',
    'intersect',
    'lazy',
    'looseObject',
    'looseTuple',
    'map',
    'nonNullable',
    'nonNullish',
    'nonOptional',
    'nullable',
    'nullish',
    'object',
    'objectWithRest',
    'optional',
    'record',
    'set',
    'strictObject',
    'strictTuple',
    'tuple',
    'tupleWithRest',
    'undefinedable',
    'union',
  ]}
/>

### Methods

<ApiList
  items={[
    'assert',
    'config',
    'fallback',
    'getDefault',
    'getDefaults',
    'getFallback',
    'getFallbacks',
    'is',
    'message',
    'parse',
    'parser',
    'pipe',
    'safeParse',
    'safeParser',
  ]}
/>

### Actions

<ApiList
  items={[
    'check',
    'brand',
    'description',
    'flavor',
    'guard',
    'metadata',
    'rawCheck',
    'rawTransform',
    'readonly',
    'title',
    'transform',
  ]}
/>

### Utils

<ApiList items={['entriesFromList', 'isOfKind', 'isOfType']} />
