# maxGraphemes

Creates a max [graphemes](https://en.wikipedia.org/wiki/Grapheme) validation action.

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

## Generics

- `TInput` <Property {...properties.TInput} />
- `TRequirement` <Property {...properties.TRequirement} />
- `TMessage` <Property {...properties.TMessage} />

## Parameters

- `requirement` <Property {...properties.requirement} />
- `message` <Property {...properties.message} />

### Explanation

With `maxGraphemes` you can validate the graphemes of a string. If the input does not match the `requirement`, you can use `message` to customize the error message.

> Hint: The number of characters per grapheme is not limited. You may want to consider combining `maxGraphemes` with <Link href="../maxLength/">`maxLength`</Link> or <Link href="../maxBytes/">`maxBytes`</Link> to set a stricter limit.

## Returns

- `Action` <Property {...properties.Action} />

## Examples

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

### Max graphemes schema

Schema to validate a string with a maximum of 8 graphemes.

```ts
const MaxGraphemesSchema = v.pipe(
  v.string(),
  v.maxGraphemes(8, 'The string must not exceed 8 graphemes.')
);
```

## Related

The following APIs can be combined with `maxGraphemes`.

### Schemas

<ApiList items={['any', 'custom', 'string']} />

### Methods

<ApiList items={['pipe']} />

### Utils

<ApiList items={['isOfKind', 'isOfType']} />
