# values

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

Creates a values validation action.

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

## Generics

- `TInput` `extends ValueInput`
- `TRequirement` `extends readonly TInput[]`
- `TMessage` `extends ErrorMessage<ValuesIssue<TInput, TRequirement>> | undefined`

## Parameters

- `requirement` `TRequirement`
- `message` `TMessage`

### Explanation

With `values` you can validate the value of a string, number, boolean or date. If the input does not match one of the values in the `requirement`, you can use `message` to customize the error message.

> This action does not change the type of the pipeline. Use the [`picklist`](/api/picklist.md) schema instead if you want the type to match the union of specific values.

## Returns

- `Action` `ValuesAction<TInput, TRequirement, TMessage>`

## Examples

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

### Number schema

Schema to validate a number with specific values.

```ts
const NumberSchema = v.pipe(
  v.number(),
  v.values([5, 15, 20], 'The number must be one of the allowed numbers.')
);
```

## Related

The following APIs can be combined with `values`.

### Schemas

[`any`](/api/any.md), [`bigint`](/api/bigint.md), [`boolean`](/api/boolean.md), [`custom`](/api/custom.md), [`date`](/api/date.md), [`number`](/api/number.md), [`string`](/api/string.md), [`unknown`](/api/unknown.md)

### Methods

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

### Utils

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