@cmdpalette/react
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

logo

CmdPalette React

A Command Palette Library for your Website or Webapp

Installation

npm install @cmdpalette/core @cmdpalette/react

Usage

See https://cmdpalette.dev/ for example usage.

Properties

commands: Array<ICmdCommand> | () => Promise<Array<ICmdCommand>> - An array of commands to be displayed in the palette. Each command is an object with the following properties:

  • command - The name of the command to be displayed in the palette
  • action - The function to be called when the command is selected, it will receive the command object back as a parameter
  • help - The help text to be displayed in the palette as helper text for your search
  • subCommands - add subcommands in the same format as commands above, they will lazy load when selected (tab)

count: number - The number of commands to be displayed in the palette, defaults to 10

open: boolean - To control the openeing and closing of the palette manually, defaults to false. The palette will self open and close using the key command check if this is not set.

placeholder: string - The placeholder text to be displayed in the search input, defaults to ""

keyCommandCheck: (e: KeyboardEvent) => boolean - To control if the palette should self open and close using a key command check, defaults checking for ctrl+k || command+k.

License

MIT

Package Sidebar

Install

npm i @cmdpalette/react

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

207 kB

Total Files

26

Last publish

Collaborators

  • mikevalstar