# isPrintableKey

> Predicate that returns true only for single-character printable keystrokes with no modifier — ideal for type-to-search lists and inline-edit fields.

Source: https://ngwr.dev/reference/utils/is-printable-key  
Kind: Util

## Usage

```angular-ts
import { isPrintableKey } from 'ngwr/utils';

// Type-to-search: only consume printable keys, ignore arrows/Enter/etc.
@HostListener('keydown', ['$event']) onKey(e: KeyboardEvent) {
  if (isPrintableKey(e)) buffer.push(e.key);
}
```

## Why ngwr provides this

The seemingly-obvious `e.key.length === 1` is wrong: it matches modifier chords too (Ctrl+A has `e.key === 'a'`, length 1). For type-to-search and inline-edit flows you want printable AND un-chorded — the predicate gets it right in one place.

```angular-ts
// Native — "length === 1" looks right but matches modifier chords.
if (e.key.length === 1) buffer.push(e.key);
// → Ctrl+A: e.key is 'a' (length 1), so this pushes 'a'. Bug.

// ngwr — excludes chorded keys explicitly.
if (isPrintableKey(e)) buffer.push(e.key);
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `isPrintableKey(event)` | True when the key is a single printable character with no modifiers. Use for type-to-search and inline-edit flows. | `(e: KeyboardEvent) => boolean` | `—` |

## See also

- [Keyboard](https://ngwr.dev/guides/keyboard) — How chords, keycaps and key primitives fit together in one task.
- [hasModifier](https://ngwr.dev/reference/utils/has-modifier) — Skip the browser’s own chords before testing for a character.
- [KEYS](https://ngwr.dev/reference/utils/keys) — Canonical `KeyboardEvent.key` constants.
