Add cmd+k interface to your solid site

Overview

solid-ninja-keys

Add cmd+k interface to your solid site. Built on top of ninja-keys.

Quick start

Install it:

yarn add solid-ninja-keys

Use it:

import { createSignal } from 'solid-js'
import { NinjaKeys } from 'solid-ninja-keys'

function App() {
  const [isDark, setIsDark] = createSignal(false)
  const hotkeys = [
    {
      id: 'Home',
      title: 'Open Home',
      hotkey: 'cmd+h',
      mdIcon: 'home',
      handler: () => {
        console.log('navigation to home')
      },
    },
    {
      id: 'Theme',
      title: 'Change theme...',
      mdIcon: 'desktop_windows',
      children: [
        {
          id: 'Light Theme',
          title: 'Change theme to Light',
          mdIcon: 'light_mode',
          handler: () => {
            setIsDark(false)
          },
        },
        {
          id: 'Dark Theme',
          title: 'Change theme to Dark',
          mdIcon: 'dark_mode',
          keywords: 'lol',
          handler: () => {
            setIsDark(true)
          },
        },
      ],
    },
  ]

  return (
    <div>
      <NinjaKeys isDark={isDark()} hotkeys={hotkeys} />
    </div>
  )
}

export default App

Props

All attributes from ninja-keys are available plus additional props below:

Field Default Description
hotkeys [] Array of ninja actions
isDark false Apply dark theme

Methods

You can access ninja-keys methods anywhere in your app via useNinjaKeys hook.

Name Arg Description
open parent?: string Open menu with parent, if null then open root menu
close Close menu
setParent parent?: string Navigate to parent menu

Example

import { useNinjaKeys } from 'solid-ninja-keys'

const {
  open,
  close,
  setParent
} = useNinjaKeys()

Styling

If you need more style control, use the CSS variables available.

Icons

By default, components use icons from https://fonts.google.com/icons . To add Material icons for your website, you need to add them to your HTML, for example

<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet">

You can also use svg or img. Please refer to the icons docs.

License

MIT License © 2022 Robert Soriano

You might also like...

This site compares your GitHub Profile to your friends, and analyses and tells your GitHub profile score too.

GitHub ⚔️ Duel Deployed at 🚀 : https://githubduel.vercel.app/ Compare your GitHub profiles with your friends It gives score to GitHub profile based o

Nov 21, 2022

This project is an Awesome Books web page where users can add or remove books from the site. It also displays a list of the books added to the collection. This Awesome books webpage was created using ES6.

Awesome books App using Module Awesome books App using Module This book list was built using modules and other ES6 syntax. It allows users to add/remo

Jul 25, 2022

This is an Awesome Books web page where users can add or remove books from the site. It also displays a list of the books added to the collection. This was a continuous project, where in each milestone, new feature(s) was/were added to it.

This is an Awesome Books web page where  users can add or remove books from the site. It also displays a list of the books added to the collection. This was a continuous project, where in each milestone, new feature(s) was/were added to it.

Awesome Books This is an Awesome Books web page where a user can add or remove books from the site. It also displays a list of the books that are adde

Aug 1, 2022

Generate meshes from signed distance functions and constructive solid geometry operations.

Generate meshes from signed distance functions and constructive solid geometry operations.

sdf-csg Generate meshes from signed distance functions and constructive solid geometry operations. This library is heavily based upon Inigo Quilez's 3

Oct 24, 2022

Solid.js library adding a services layer for global shared state.

Solid.js library adding a services layer for global shared state.

Solid Services Services are "global" objects useful for features that require shared state or persistent connections. Example uses of services might i

Dec 30, 2022

solid material ui port (ported from blazor port)

solid-material-ui solid material ui port (porting from blazor port) In preparation for solid hack Turbo Mono-repository is used for component package

Apr 30, 2022

Solid hooks for Firebase v9.

solid-firebase Solid hooks for Firebase. Quick start Install it: yarn add firebase solid-firebase Configure firebase app: import { render } from 'soli

Dec 23, 2022

[WIP] A solid directive for adding colorful shadows to images.

solid-cosha A solid directive for adding colorful shadows to images (based on cosha). Quick start Install it: yarn add solid-cosha Use it: import { co

Feb 3, 2022

A helper to use immer as Solid.js Signal to drive state

Solid Immer A helper to use immer as Solid.js Signal to drive state. Installation $ npm install solid-immer Usage Use createImmerSignal to create a im

Nov 22, 2022
Owner
Robert Soriano
[object Object]
Robert Soriano
Este projeto acelara o desenvolvimento com express, gerando uma estrutura completa e opções de gerar controller mode e view pelo cmd.

fast-developer-express Este projeto acelara o desenvolvimento com express, gerando uma estrutura completa e opções de gerar controller mode e view pel

Rodrino Adolfo Kupessala 1 Dec 21, 2021
Detect the executable python interpreter cmd in $PATH.

detect-python-interpreter Detect the executable python interpreter cmd in $PATH. Installation $ npm install --save detect-python-interpreter Usage con

Khaidi Chu 2 Apr 12, 2022
This single-page application displays a site where users can add/remove books from an interface and navigate between sections using ES6 Js.

Awesome Books - ES6 Web app that allows to add and remove book's data using Javascript and ES6 conventions. Built With HTML CSS Javascript ES6 Prerequ

Romina Patiño 5 Aug 19, 2022
A Node.JS and CLI interface for Solid

Bashlib This repository contains a suite of functionality to facilitate use and development for Solid, mainly focused on supporting the Community Soli

SolidLab 15 Dec 15, 2022
Easily add aspect ratio in your Solid app.

Creates a component with a proportional relationship between its width and height. ratio = width / height Table of Contents Demo Installation Setup Us

Prince Neil Cedrick Castro 5 Nov 4, 2022
A crawler that crawls the site's internal links, fetching information of interest to any SEO specialist to perform appropriate analysis on the site.

Overview ?? It is a module that crawls sites and extracts basic information on any web page of interest to site owners in general, and SEO specialists

Yazan Zoghbi 2 Apr 22, 2022
A crawler that crawls the site's internal links, fetching information of interest to any SEO specialist to perform appropriate analysis on the site.

Overview ?? It is a module that crawls sites and extracts basic information on any web page of interest to site owners in general, and SEO specialists

Yazan Zoghbi 2 Apr 22, 2022
A small web app that tries to imitate the desktop web version of amazon site, you can add items to the basket, delete them, and have your user authentication feature thanks to Firebase.

Features Here's the feature's included in this project ??‍??‍??‍?? Login Page ?? Products Page ?? Cart and Checkout Page ?? Sign up function with Goog

Murad Rahmanzada 16 Aug 22, 2022
Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan with <3

Gutpress(WordPress Gutenburg Block Plugin) Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan w

Arif Khan 4 Nov 23, 2022
🔥 Set up your new Solid component library in seconds!

Create Solid Library Create SolidJS libraries with ease! Usage npx create-solid-library <name> Development Developing components is often a visual pro

blusk 6 Oct 28, 2022