Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itaditya/solid-command-palette
UI Library for Command Palette in SolidJS webapps
https://github.com/itaditya/solid-command-palette
command-palette solid-js
Last synced: 5 days ago
JSON representation
UI Library for Command Palette in SolidJS webapps
- Host: GitHub
- URL: https://github.com/itaditya/solid-command-palette
- Owner: itaditya
- Created: 2022-01-22T14:53:42.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-28T15:04:22.000Z (5 months ago)
- Last Synced: 2024-10-10T21:19:35.061Z (2 months ago)
- Topics: command-palette, solid-js
- Language: TypeScript
- Homepage: https://solid-command-palette.vercel.app/
- Size: 3.21 MB
- Stars: 157
- Watchers: 2
- Forks: 12
- Open Issues: 13
-
Metadata Files:
- Readme: .github/README.md
Awesome Lists containing this project
- awesome-solid-js - Solid Command Palette - UI Library for Command Palette in SolidJS webapps (📦 Components & Libraries / Misc.)
README
Boost your users productivity by 10x 🚀
### Some of the features offered by this library-
1. Define actions with a simple config.
1. Full keyboard support like open with CMD + K, navigate between actions using arrow keys.
1. Fuzzy search between your actions on title, subtile, keywords.
1. Bind custom keyboard shortcuts to your actions. They can be single letter, modifier combinations Shift + l or sequences g p.
1. Enable actions based on dynamic conditions.
1. Share your app state and methods to run any kind of functionality from actions.
1. Full static type safety across the board.## Demo
![Solid Command Palette Demo](../public/images/demo-minimal.gif)
Try the full demo on [our documentation site](https://solid-command-palette.vercel.app/demo).
## Usage
#### Install the library
```sh
# Core Library
npm install solid-command-palette# Peer Dependencies
npm install solid-transition-group tinykeys fuse.js
```- [solid-transition-group](https://github.com/solidjs/solid-transition-group) (1.6KB): provides advanced animation support. It's the official recommendation from SolidJS team so you might be using it already.
- [tinykeys](https://github.com/jamiebuilds/tinykeys) (700B): provides keyboard shortcut support. You can use this in your app for all kinds of keybindings.
- [fuse.js](https://github.com/krisk/fuse) (5KB): provides fuzzy search support to find relevant actions.#### Integrate with app
```jsx
// define actions in one module say `actions.ts`import { defineAction } from 'solid-command-palette';
const minimalAction = defineAction({
id: 'minimal',
title: 'Minimal Action',
run: () => {
console.log('ran minimal action');
},
});const incrementCounterAction = defineAction({
id: 'increment-counter',
title: 'Increment Counter by 1',
subtitle: 'Press CMD + E to trigger this.',
shortcut: '$mod+e', // $mod = Command on Mac & Control on Windows.
run: ({ rootContext }) => {
rootContext.increment();
},
});export const actions = {
[minimalAction.id]: minimalAction,
[incrementCounterAction.id]: incrementCounterAction,
};
``````jsx
// render inside top level Solid componentimport { Root, CommandPalette } from 'solid-command-palette';
import { actions } from './actions';
import 'solid-command-palette/pkg-dist/style.css';const App = () => {
const actionsContext = {
increment() {
console.log('increment count state by 1');
},
};return (
);
};
```