# 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), [`number`](/api/number.md), [`unknown`](/api/unknown.md)

### Methods

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

### Utils

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