# empty

> This document is the Markdown version of [valibot.dev/api/empty/](https://valibot.dev/api/empty/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates an empty validation action.

```ts
const Action = v.empty<TInput, TMessage>(requirement, message);
```

## Generics

- `TInput` `extends LengthInput`
- `TMessage` `extends ErrorMessage<EmptyIssue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `empty` you can validate that a string or array is empty. If the input is not empty, you can use `message` to customize the error message.

## Returns

- `Action` `EmptyAction<TInput, TMessage>`

## Examples

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

### String schema

Schema to validate that a string is empty.

```ts
const StringSchema = v.pipe(v.string(), v.empty('The string must be empty.'));
```

### Array schema

Schema to validate that an array is empty.

```ts
const ArraySchema = v.pipe(
  v.array(v.number()),
  v.empty('The array must be empty.')
);
```

## Related

The following APIs can be combined with `empty`.

### Schemas

[`any`](/api/any.md), [`array`](/api/array.md), [`custom`](/api/custom.md), [`instance`](/api/instance.md), [`string`](/api/string.md), [`tuple`](/api/tuple.md), [`unknown`](/api/unknown.md)

### Methods

[`pipe`](/api/pipe.md)

### Utils

[`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)
