GitHub Stars
Docs
Keyboard

Keyboard

Displays an animated keyboard with keycaps that can be customized with different colors and variants.

`~
@2
#3
$4
%5
^6
&7
*8
(9
)0
_-
+=
Tab
Q
W
E
R
T
Y
U
I
O
P
Caps
A
S
D
F
G
H
J
K
L
:;
"'
Shift
Z
X
C
V
B
N
M
<,
>.
?/
alt
Space

Installation

pnpm dlx shadcn@latest add https://badtz-ui.com/r/animated-keyboard.json

Examples

`~
@2
#3
$4
%5
^6
&7
*8
(9
)0
_-
+=
Tab
Q
W
E
R
T
Y
U
I
O
P
Caps
A
S
D
F
G
H
J
K
L
:;
"'
Shift
Z
X
C
V
B
N
M
<,
>.
?/
alt
Space
1
2
3
4
5
6
7
8
9
Tab
Q
!1
A
@2
Caps

Usage

import {
  Keycap,
  KeyRow,
  Keyboard,
} from "@/registry/components/animated-keyboard";
<Keyboard>
  <KeyRow>
    <Keycap variant="tab" char="Tab" />
    <Keycap char="Q" />
    <Keycap variant="double" char="1" secondaryChar="!" />
  </KeyRow>
  <KeyRow>
    <Keycap char="A" />
    <Keycap variant="double" char="2" secondaryChar="@" />
    <Keycap variant="caps" char="Caps" />
  </KeyRow>
</Keyboard>

Props

Keycap props.

PropTypeDescriptionDefault
heightstringHeight of the keycap."56px"
keylightColor"default" | "red" | "blue" | "green" | "purple" | "rgb"Color of the keycap's light effect."default"
charstringMain character displayed on the keycap.-
secondaryCharstringSecondary character displayed on the keycap (only for variant="double").-
variant"default" | "double" | "tab" | "caps" | "shift" | "command" | "space"Variant of the keycap."default"
classNamestringAdditional custom classes.-

Keyboard props.

PropTypeDescriptionDefault
childrenReactNodeChild components to be rendered inside the keyboard.-
classNamestringAdditional custom classes.-
gap"sm" | "md" | "lg"Spacing between key rows."md"

KeyRow props.

PropTypeDescriptionDefault
childrenReactNodeChild components to be rendered inside the key row.-
classNamestringAdditional custom classes.-
gap"sm" | "md" | "lg"Spacing between keycaps."md"
Previous
Next