# nonTrimmed

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

Creates a non-trimmed validation action.

> `nonTrimmed` is the opposite of [`trimmed`](/api/trimmed.md). Since an empty string has no leading or trailing whitespace, it is also rejected.

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

## Generics

- `TInput` `extends string`
- `TMessage` `extends ErrorMessage<NonTrimmedIssue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `nonTrimmed` you can validate that a string has leading or trailing whitespace. If the input is trimmed, you can use `message` to customize the error message.

## Returns

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

## Examples

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

### Indented line schema

Schema to validate that a line starts or ends with whitespace.

```ts
const IndentedLineSchema = v.pipe(
  v.string(),
  v.nonTrimmed('The line must start or end with whitespace.')
);
```

## Related

The following APIs can be combined with `nonTrimmed`.

### Schemas

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

### Methods

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

### Utils

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