0.0.18 • Published 3 years ago
svelte-kbar v0.0.18
Svelte kbar
Svelte re-implementation of https://github.com/timc1/kbar
Usage
- Install in your project
yarn add svelte-kbar
or
npm install svelte-kbar
- Use the KBar component in your svelte app
See this live in the Svelte REPL
<script>
import { KBar } from 'svelte-kbar';
const actions = [
{
id: 'blog',
name: 'Blog',
shortcut: ['b'],
keywords: 'writing words',
perform: () => console.log('blog')
},
{
id: 'contact',
name: 'Contact',
shortcut: ['c'],
keywords: 'email',
perform: () => console.log('contact')
},
{
id: 'theme',
name: 'Set Theme',
shortcut: ['t'],
keywords: 'dark light mode',
children: ['dark', 'light']
},
{
id: 'dark',
name: 'Dark Mode',
parent: 'theme',
shortcut: ['d'],
keywords: '',
perform: () => {
console.log('Dark mode');
}
},
{
id: 'light',
name: 'Light Mode',
parent: 'theme',
shortcut: ['d'],
keywords: '',
perform: () => {
console.log('Light mode');
}
}
];
</script>
<KBar {actions} />
Development Setup
- Clone this repository
git clone git@github.com:dwagio/svelte-kbar.git
- Install dependencies
yarn install
- Start the dev server
yarn run dev
- Go to http://localhost:3000 to see your live development instance.