shadcn.io is not affiliated with official shadcn/ui
Kbd examples · Arrow Keys
Arrow Keys Horizontal Kbd for React
Left and right arrow keys grouped side by side.
Many controls only move one way: carousels, slides, image galleries, pagination. This React example shows ← and → in a KbdGroup, which spaces the two caps evenly and keeps them together as one hint, without the up and down keys that don't apply.
Preview
Installation
FAQ
When should I show only the left and right arrows?
When the control only moves sideways: a carousel, a slideshow, a timeline, previous and next pages. Showing up and down there suggests keys that do nothing.
What does KbdGroup do for the arrows?
It lays the two Kbd caps out in a row with a small gap and keeps them on one line. Unlike a chord such as ⌘K, the arrows here are alternatives, so make that clear in the text around them, for example Use ← → to move.
Should left come before right?
Yes, as on the keyboard, with left first. In right-to-left interfaces a carousel usually moves the other way, so check which key goes forward and label the hint to match.
How do I show that the arrows control a carousel?
Put the hint next to the carousel's previous and next buttons, or in its caption. Make sure the arrows really move it: the hint should match what the keys do.
Related
- Arrow Keys Cross Pattern KbdFour arrow keys in the inverted T of a
- WASD Gaming Keys KbdThe W, A, S and D movement keys in an
- Vim Navigation Keys KbdThe H, J, K and L keys in one row, the
- Standard CarouselA basic carousel of five numbered slides
- Editing Keys KbdThe Home, End, PgUp and PgDn editing keys
- F1 Help Key KbdA single F1 key, the usual shortcut for