# @fluentui/keyboard-keys

> Contains a set of keyboard constants for key and keyCode

Latest version **9.0.9** (published 2026-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fluentui/keyboard-keys
pnpm add @fluentui/keyboard-keys
yarn add @fluentui/keyboard-keys
bun add @fluentui/keyboard-keys
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 9.0.9 |
| Published | 2026-08-11 |
| First published | 2021-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 230.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20272 |
| Maintainers | uifabricteam, uifrnbot, microsoft1es, microsoft-oss-releases |

## Links

- npm: https://www.npmjs.com/package/@fluentui/keyboard-keys
- Repository: https://github.com/microsoft/fluentui
- Homepage: https://github.com/microsoft/fluentui#readme
- Issues: https://github.com/microsoft/fluentui/issues
- npm.io page: https://npm.io/package/@fluentui/keyboard-keys

## Dependencies (1)

- [@swc/helpers](https://npm.io/package/@swc/helpers.md) ^0.5.1

## Recent versions

- 9.0.9 (latest) — 2026-08-11
- 0.0.0-nightly-20261002-0407.1 (nightly) — 2026-10-02
- 9.74.5-experimental.tabster-v9.20260804-bb909442fe.0 (experimental) — 2026-08-04
- 9.0.0-rc.6 (rc) — 2022-05-05
- 0.0.0-nightly0e0cf06c3420211029.1 (false,nightly) — 2021-10-29
- 9.0.0-beta.1 (beta) — 2021-10-06
- 9.0.0-alpha.5 (alpha) — 2021-10-01
- 0.0.0-nightly-20260929-0404.1 — 2026-09-29
- 0.0.0-nightly-20260928-0404.1 — 2026-09-28
- 0.0.0-nightly-20260925-0403.1 — 2026-09-25
- 0.0.0-nightly-20260924-0403.1 — 2026-09-24
- 0.0.0-nightly-20260923-0404.1 — 2026-09-23
- 0.0.0-nightly-20260922-0403.1 — 2026-09-22
- 0.0.0-nightly-20260917-0408.1 — 2026-09-17
- 0.0.0-nightly-20260916-0409.1 — 2026-09-16
- … 1162 more at https://npm.io/package/@fluentui/keyboard-keys/versions

## README

# @fluentui/keyboard-keys

Contains a set of keyboard constants for key and keyCode comparison in components. This package contains
**named key values** from [The w3 uievents-key specification](https://www.w3.org/TR/uievents-key/).

Unicode values are not included since there are a lot of locales to consider and they provide no benefit since
unicode characters can be used directly in code.

# Usage

```ts
import { Enter } from '@fluentui/keyboard-keys';

const onKeyDown = (e: React.KeyboardEvent) => {
  if (e.key === Enter) {
    // ...
  }

  // Unicode characters 'a', '1', '%'...
  // should be used directly in code
  if (e.key === 'a') {
    // ...
  }
};
```

## Legacy keyCode

In order to migrate easily from `@fluentui/keyboard-key` legacy `keyCode` support is available in this library but
is not encouraged for reuse since this propoerty has been deprecated for a while and will be removed in future
standards.

```ts
import { keyCodes } from '@fluentui/keyboard-keys';

const onKeyDown = (e: React.KeyboardEvent) => {
  if (e.keyCode === keyCodes.Enter) {
    // ...
  }

  if (e.key === keyCodes.a) {
    // ...
  }
};
```

---
_Source: https://npm.io/package/@fluentui/keyboard-keys · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
