Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cmdk

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmdk

  • 0.1.20
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
increased by0.48%
Maintainers
1
Weekly downloads
 
Created

What is cmdk?

cmdk is a React component library for building command menus. It provides a flexible and customizable way to create command palettes, similar to those found in applications like VSCode, Figma, and Notion.

What are cmdk's main functionalities?

Basic Command Menu

This code demonstrates how to create a basic command menu using cmdk. It includes an input field for typing commands and a list of command items.

import { Command } from 'cmdk';

function App() {
  return (
    <Command>
      <Command.Input placeholder="Type a command or search..." />
      <Command.List>
        <Command.Item>First Command</Command.Item>
        <Command.Item>Second Command</Command.Item>
      </Command.List>
    </Command>
  );
}

Nested Command Menus

This code demonstrates how to create nested command menus using cmdk. It shows how to include a sub-menu within a command item.

import { Command } from 'cmdk';

function App() {
  return (
    <Command>
      <Command.Input placeholder="Type a command or search..." />
      <Command.List>
        <Command.Item>First Command</Command.Item>
        <Command.Item>Second Command</Command.Item>
        <Command.Item>
          Nested Menu
          <Command.List>
            <Command.Item>Nested Command 1</Command.Item>
            <Command.Item>Nested Command 2</Command.Item>
          </Command.List>
        </Command.Item>
      </Command.List>
    </Command>
  );
}

Custom Styling

This code demonstrates how to apply custom styling to the command menu and its elements using CSS classes.

import { Command } from 'cmdk';
import './App.css';

function App() {
  return (
    <Command className="custom-command">
      <Command.Input className="custom-input" placeholder="Type a command or search..." />
      <Command.List className="custom-list">
        <Command.Item className="custom-item">First Command</Command.Item>
        <Command.Item className="custom-item">Second Command</Command.Item>
      </Command.List>
    </Command>
  );
}

Other packages similar to cmdk

FAQs

Package last updated on 06 Sep 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc