
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@beskar-labs/command-bar
Advanced tools
A pre-configured cmdk instance with hooks, keyboard shortcuts, Gamepad support and animations.
command-bar
is a pre-configured cmdk instance with:
useCommandBar
hookyarn add @beskar-labs/command-bar
You can use command-bar
the same way you would use cmdk
, with a few additions. Here's an example with Tailwind:
import { CommandBar, useCommandBar } from '@beskar-labs/command-bar';
const App = () => {
const commandBar = useCommandBar();
return (
<CommandBar.Dialog className="fixed inset-0 z-50 flex items-center justify-center bg-gray-50/80 backdrop-blur-sm dark:bg-gray-800/80">
<CommandBar.Container className="w-full max-w-xl rounded-md border border-gray-200 bg-white drop-shadow-2xl transition-transform dark:border-gray-700 dark:bg-gray-900">
<CommandBar.Input className="w-full bg-transparent py-3 text-gray-900 outline-none placeholder:text-gray-400 dark:text-white dark:placeholder:text-gray-600" />
<CommandBar.List className="h-full max-h-[25rem] min-h-[15rem] overflow-auto p-4 text-sm text-gray-500 dark:text-gray-400">
<CommandBar.Empty>Empty State</CommandBar.Empty>
<CommandBar.Loading />
<CommandBar.Group
className="mb-4 space-y-1 last:mb-0"
heading="Letters"
>
<CommandBar.Item className="text-md -mx-2 flex cursor-pointer items-center justify-between gap-2 rounded-sm p-2 aria-selected:bg-gray-100 dark:aria-selected:bg-gray-800">
a
</CommandBar.Item>
<CommandBar.Item className="text-md -mx-2 flex cursor-pointer items-center justify-between gap-2 rounded-sm p-2 aria-selected:bg-gray-100 dark:aria-selected:bg-gray-800">
b
</CommandBar.Item>
<CommandBar.Separator />
<CommandBar.Item className="text-md -mx-2 flex cursor-pointer items-center justify-between gap-2 rounded-sm p-2 aria-selected:bg-gray-100 dark:aria-selected:bg-gray-800">
c
</CommandBar.Item>
</CommandBar.Group>
</CommandBar.List>
</CommandBar.Container>
</CommandBar.Dialog>
);
};
k
: Toggles the command bar. On Mac, this is cmd+k
. On Windows, this is ctrl+k
.Backspace
: If the search input is empty, goes back to the root.Escape
: If you're on the root, closes the command bar. If you're not, goes back to the root.Relies on @beskar-labs/use-gamepad-events to map Gamepad buttons to commandbar actions:
y
: opens and closes the commandbar, utilising toggleOpen
from useCommandBar
b
: goes back to the root, utilising setPage('')
from useCommandBar
a
: selects the current item, utilising select
from useCommandBar
up
/ down
: navigates the commandbar, utiling setIndex
from useCommandBar
FAQs
A pre-configured cmdk instance with hooks, keyboard shortcuts, Gamepad support and animations.
We found that @beskar-labs/command-bar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.