David Hakobyana

Astryx Kbd

Component

About

Renders a keyboard shortcut as styled key badges. Use Kbd in tooltips, menus, and help text to show key combinations. Astryx by Meta. Source: https://astryx.atmeta.com/components/Kbd

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Kbd to your project and fits it to your theme.

Code

How Astryx Kbd is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

/* Copyright (c) 2026 Meta Platforms, Inc. See the MIT notice in astryx-kbd.tsx. */

import '@/components/ui/astryx-kbd-utils/astryx-preview.css';
import '@astryxdesign/theme-neutral/fonts.css';
import {useSyncExternalStore} from 'react';
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';

import {Kbd} from '@/components/ui/astryx-kbd';

function OfficialSample() {
  return <Kbd keys="mod+k" />;
}

function readPreviewMode() {
  const {classList} = document.documentElement;
  return classList.contains('dark') ? 'dark' : 'light';
}

function subscribeToPreviewMode(callback: () => void) {
  const observer = new MutationObserver(callback);
  observer.observe(document.documentElement, {attributes: true, attributeFilter: ['class']});
  return () => observer.disconnect();
}

export default function Demo() {
  const mode = useSyncExternalStore(subscribeToPreviewMode, readPreviewMode, () => 'light' as const);
  return (
    <Theme theme={neutralTheme} mode={mode}>
      <div className="astryx-demo">
        <div className="astryx-demo-content" data-centered style={{maxWidth: 260}}>
          <OfficialSample />
        </div>
      </div>
    </Theme>
  );
}

Dependencies

More by David Hakobyana

View all
  • Futuristic Hero

    Futuristic Hero

    2.7K
  • Hero ASCII one

    Hero ASCII one

    1.4K
  • Hero ASCII

    Hero ASCII

    1.4K
  • Admit One Ticket

    Admit One Ticket

    1.2K
  • Border Beam

    Border Beam

    1.1K
  • Navigation Menu

    Navigation Menu

    1K
  • Border Beam Search

    Border Beam Search

    738
  • Thinking Orbs

    Thinking Orbs

    533