---
id: api/cypress-api/keyboard-api
title: Cypress.Keyboard
description: Set the default values for how the .type() command is executed in Cypress.
section: api
source_path: docs/api/cypress-api/keyboard-api.mdx
version: dd1b4f9adc7e2fae428f3afbd4b3686f68b7cdc9
updated_at: '2026-09-12T13:36:55.674Z'
---
# Cypress.Keyboard

The Keyboard API allows you to access available `Keys` for use with [`cy.press()`](/llm/markdown/api/commands/press.md) or to set the default values for how the [.type()](/llm/markdown/api/commands/type.md) command is executed.

## Syntax

```
Cypress.Keyboard.Keys(key)
Cypress.Keyboard.defaults(options)
```

### Keys Arguments

**key _(String)_**

The key available for `cy.press()`.

The following keys are supported:

| Reference | Value |
| --- | --- |
| Letters | `"a"` through `"z"`, `"A"` through `"Z"` |
| Numbers | `"0"`, `"1"`, `"2"`, `"3"`, `"4"`, `"5"`, `"6"`, `"7"`, `"8"`, `"9"` |
| Special Characters | `"!"`, `"@"`, `"#"`, `'+'`, `"€"`, `"é"`, etc. |
| `Cypress.Keyboard.Keys.UP` | `"ArrowUp"` |
| `Cypress.Keyboard.Keys.DOWN` | `"ArrowDown"` |
| `Cypress.Keyboard.Keys.LEFT` | `"ArrowLeft"` |
| `Cypress.Keyboard.Keys.RIGHT` | `"ArrowRight"` |
| `Cypress.Keyboard.Keys.ESC` | `"Escape"` |
| `Cypress.Keyboard.Keys.END` | `"End"` |
| `Cypress.Keyboard.Keys.HOME` | `"Home"` |
| `Cypress.Keyboard.Keys.PAGEDOWN` | `"PageDown"` |
| `Cypress.Keyboard.Keys.PAGEUP` | `"PageUp"` |
| `Cypress.Keyboard.Keys.ENTER` | `"Enter"` |
| `Cypress.Keyboard.Keys.TAB` | `"Tab"` |
| `Cypress.Keyboard.Keys.BACKSPACE` | `"Backspace"` |
| `Cypress.Keyboard.Keys.DELETE` | `"Delete"` |
| `Cypress.Keyboard.Keys.INSERT` | `"Insert"` |
| `Cypress.Keyboard.Keys.SPACE` | `"Space"` |

### defaults Arguments

**options _(Object)_**

An object containing the following:

| Option | Default | Description |
| --- | --- | --- |
| `keystrokeDelay` | `null` | The delay, in milliseconds, between keystrokes while typing with [.type()](/llm/markdown/api/commands/type.md). Must be a non-negative number. |

`keystrokeDelay` can also be set in the [Cypress configuration](/llm/markdown/app/references/configuration.md#Keyboard). The resolved value is read from the configuration first, then from `Cypress.Keyboard.defaults()`, and falls back to `0` if neither is set. A per-command `delay` passed to [`.type()`](/llm/markdown/api/commands/type.md) is independent of this and overrides the resolved value for that single call.

## Examples

### Press tab key

```
cy.press(Cypress.Keyboard.Keys.TAB)
cy.get('input.second').should('have.focus')
```

### Slow down typing by increasing the keystroke delay

```
Cypress.Keyboard.defaults({
  keystrokeDelay: 20,
})
```

## Notes

### Where to put Keyboard configuration

A great place to put this configuration is in the [supportFile](/llm/markdown/app/core-concepts/writing-and-organizing-tests.md#Support-file), since it is loaded before any test files are evaluated.

### Set the keystroke delay in test configuration

The keystroke delay can also be set via [test configuration](/llm/markdown/app/core-concepts/writing-and-organizing-tests.md#Test-Configuration), which can be useful when setting it for a single test or a subset of tests.

```
it(
  'adds a keystroke delay for all typing in this test',
  { keystrokeDelay: 10 },
  () => {
    cy.get('input').eq(0).type('slow typing')
    cy.get('input').eq(1).type('more slow typing')
  }
)

describe(
  'adds a keystroke delay in all tests in this suite',
  { keystrokeDelay: 10 },
  () => {
    it('types with delay in the first input', () => {
      cy.get('input').eq(0).type('slow typing')
    })

    it('types with delay in the second input', () => {
      cy.get('input').eq(1).type('more slow typing')
    })
  }
)
```

## See also

*   [`cy.press()`](/llm/markdown/api/commands/press.md)
*   [`.type()`](/llm/markdown/api/commands/type.md)
