<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[synccn]]></title><description><![CDATA[Build better interfaces with Synccn, an open-source React UI library featuring customizable components, application blocks, and seamless shadcn integration.]]></description><link>https://synccn.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6b058787cbeb3661854e6820/ae6be84c-e388-4afe-b455-230f1c386033.png</url><title>synccn</title><link>https://synccn.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 12:35:19 GMT</lastBuildDate><atom:link href="https://synccn.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Add a ⌘K command palette to your React app in 5 minutes]]></title><description><![CDATA[Add a keyboard-first ⌘K command palette to a React + Tailwind app: search, groups, shortcuts and keyboard navigation, using the free synccn component.]]></description><link>https://synccn.hashnode.dev/add-a-k-command-palette-to-your-react-app-in-5-minutes</link><guid isPermaLink="true">https://synccn.hashnode.dev/add-a-k-command-palette-to-your-react-app-in-5-minutes</guid><category><![CDATA[React]]></category><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[synccn]]></dc:creator><pubDate>Tue, 24 Nov 2026 13:00:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b058787cbeb3661854e6820/0f7e435f-9a6a-482b-a1d5-11d5d9ec2c93.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Command palettes have become the fastest way to get around an app. Press ⌘K, type a few letters, hit Enter. Linear, Vercel and Raycast all use one.</p>
<p>This guide adds one to a React + Tailwind app using the <code>command</code> component from <a href="https://synccn.com">synccn</a>, a free library of accessible React components you install as source code.</p>
<h2>1. Add the synccn registry</h2>
<p>synccn works with the shadcn CLI. If your project already uses shadcn/ui, add the synccn registry to <code>components.json</code>:</p>
<pre><code class="language-json">{
  "registries": {
    "@synccn": "https://synccn.com/r/{name}.json"
  }
}
</code></pre>
<h2>2. Install the component</h2>
<pre><code class="language-bash">npx shadcn@latest add @synccn/command
</code></pre>
<p>This creates <code>components/ui/command.tsx</code> in your project. It's your file now, so you can restyle or extend anything in it.</p>
<h2>3. Build the palette</h2>
<p><code>Command</code> takes groups of items. Each item has a label, an optional icon and shortcut, and an <code>onSelect</code> handler:</p>
<pre><code class="language-tsx">import { CreditCard, Settings, User, UserPlus } from "lucide-react";
import { Command } from "@/components/ui/command";

export function Palette({ onDone }: { onDone: () =&gt; void }) {
  const run = (fn: () =&gt; void) =&gt; () =&gt; {
    fn();
    onDone();
  };

  return (
    &lt;Command
      autoFocus
      placeholder="Type a command or search…"
      groups={[
        {
          heading: "Suggestions",
          items: [
            { label: "Invite teammate", icon: UserPlus, onSelect: run(() =&gt; console.log("invite")) },
          ],
        },
        {
          heading: "Settings",
          items: [
            { label: "Profile", icon: User, shortcut: "⌘P", onSelect: run(() =&gt; console.log("profile")) },
            { label: "Billing", icon: CreditCard, shortcut: "⌘B", onSelect: run(() =&gt; console.log("billing")) },
            { label: "Preferences", icon: Settings, keywords: "options config", onSelect: run(() =&gt; console.log("prefs")) },
          ],
        },
      ]}
    /&gt;
  );
}
</code></pre>
<p>Typing filters the list, the arrow keys move through it and Enter runs the highlighted item. <code>keywords</code> lets an item match words that aren't in its label, so "config" finds Preferences.</p>
<h2>4. Open it with ⌘K</h2>
<p>Listen for ⌘K (or Ctrl+K on Windows and Linux) and show the palette over the page:</p>
<pre><code class="language-tsx">import { useEffect, useState } from "react";
import { Palette } from "./palette";

export function CommandMenu() {
  const [open, setOpen] = useState(false);

  useEffect(() =&gt; {
    const onKey = (e: KeyboardEvent) =&gt; {
      if (e.key.toLowerCase() === "k" &amp;&amp; (e.metaKey || e.ctrlKey)) {
        e.preventDefault();
        setOpen((o) =&gt; !o);
      }
      if (e.key === "Escape") setOpen(false);
    };
    window.addEventListener("keydown", onKey);
    return () =&gt; window.removeEventListener("keydown", onKey);
  }, []);

  if (!open) return null;

  return (
    &lt;div className="fixed inset-0 z-50 flex items-start justify-center px-4 pt-[15vh]"&gt;
      &lt;div className="absolute inset-0 bg-black/50 backdrop-blur-sm" onClick={() =&gt; setOpen(false)} /&gt;
      &lt;div className="relative w-full max-w-lg"&gt;
        &lt;Palette onDone={() =&gt; setOpen(false)} /&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  );
}
</code></pre>
<p>Render <code>&lt;CommandMenu /&gt;</code> once near the root of your app, and ⌘K works on every page.</p>
<h2>Make it yours</h2>
<p>Because the component lives in your codebase, you can change it any way you like: add recent items, wire it to your router, or restyle it to match your brand. If you use synccn's Theme Studio, the palette picks up your colours and radius automatically.</p>
<hr />
<p>You can see <code>command</code> running live, along with the rest of the library, at <strong><a href="https://synccn.com">synccn.com</a></strong>.</p>
]]></content:encoded></item></channel></rss>