﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head># integer

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

Creates an [integer](https://en.wikipedia.org/wiki/Integer) validation action.

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

## Generics

- `TInput` `extends number`
- `TMessage` `extends ErrorMessage<IntegerIssue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `integer` you can validate the value of a number. If the input is not an integer, you can use `message` to customize the error message.

## Returns

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

## Examples

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

### Integer schema

Schema to validate an integer.

```ts
const IntegerSchema = v.pipe(
  v.number(),
  v.integer('The number must be an integer.')
);
```

## Related

The following APIs can be combined with `integer`.

### Schemas

[`any`](/api/any.md), [`custom`](/api/custom.md), 