---
title: "Type Sound"
description: "A keystroke with a click, a spring and a soft thock, at a little random pitch, for text fields, search and chat inputs."
category: "Sounds"
publishedAt: "2026-11-24"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/sounds/type-sound"
markdown: "https://beui.dev/sounds/type-sound.md"
license: "MIT"
---

# Type Sound

> A keystroke with a click, a spring and a soft thock, at a little random pitch, for text fields, search and chat inputs.

## Install

```bash
npx shadcn@latest add @beui/type-sound
```

## Dependencies

- `clsx`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

import { useSound } from "@/lib/sound";
import { typeSound } from "@/lib/sounds/type";

export function TypeSoundUsage() {
  const play = useSound(typeSound);
  return (
    <input
      aria-label="Message"
      placeholder="Type a message"
      // One keystroke sound per printable key, Space and Backspace.
      onKeyDown={(event) => {
        if (event.key.length === 1 || event.key === "Backspace") play();
      }}
      className="h-9 w-64 rounded-full border border-border bg-card px-4 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring"
    />
  );
}
```

## API Reference

### sound.play(options)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `volume` | `number` | `1` | No | 0 to 1, multiplied with the SoundProvider volume. |
| `pitch` | `number` | `1` | No | Pitch multiplier; 1 is the designed pitch. |

### useSound(sound, options)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `enabled` | `boolean` | `true` | No | False makes play do nothing, for a component's sound prop. |
| `volume` | `number` | `1` | No | 0 to 1 for this sound, on top of the provider volume. |

## About Type Sound

Type Sound is an interface sound for React and the web, synthesized live with Web Audio. It is a short keystroke: the key's click, a faint spring and a soft thock as it bottoms out, with random pitch on every press so fast typing sounds natural. Import typeSound and call play(), or use the useSound hook, which follows SoundProvider for app-wide volume and mute.

### When to use it

- Chat inputs and message composers.
- Search fields and command palettes.
- Terminal or typewriter style text effects.

### Accessibility

A sound plays only in answer to the user's own input, never on its own, and it never carries meaning alone: pair it with the visible change it marks. Wrap the app in SoundProvider to give people one mute switch and a volume, and remember their choice.

### FAQ

**Does it load an audio file?**

No. typeSound is a short recipe that Web Audio plays the moment it is called: a click of filtered noise for the contact, a body that rings at the partials of a real material and settles in pitch, and a touch of a small room generated in code. Nothing is downloaded and it works offline.

**How do I play it outside React?**

Call typeSound.play() from any event handler. In React, useSound(typeSound) gives a stable play function that respects SoundProvider and a component's sound prop.

**Why is there no sound on page load?**

Browsers only start audio after a user gesture. The first press or key unlocks it, which also keeps sounds tied to what the user did.

## Source

- Registry detail: https://beui.dev/r/type-sound
- Raw source: https://beui.dev/r/type-sound/raw
- GitHub: https://github.com/starc007/ui-components
