Giter VIP home page Giter VIP logo

astro-command-palette's Introduction

Astro Command Palette Astro Command Palette

A minimal command palette for Astro with 0 dependencies. Showcase Showcase

Getting Started

🛠️ Installation

npm install astro-command-palette

🚀 Usage

Just by importing the component and putting inside the body, your command palette is already working.

---
import CommandPalette from 'astro-command-palette';
---

<body>
  <CommandPalette />
</body>

💨 Creating Actions

<script>
  import createCommandPaletteItems from 'astro-command-palette/hooks';
  
  createCommandPaletteItems([
    {
      type: 'action',
      name: 'My New Action',
      icon: '<svg>...</svg>', // Optional
      handler: () => console.log("Hello Word!")
    },
    // A link action without icon
    {
      type: 'action',
      name: 'My New Link',
      url: 'https://github.com'
    }
  ])
</script>

📄 Creating Pages

You can also define nested pages with more actions:

<script>
  import createCommandPaletteItems from 'astro-command-palette/hooks';
  
  createCommandPaletteItems([
    {
      type: 'page',
      name: 'My New Page',
      icon: '<svg>...</svg>', // Optional
      actions: [/* Define the actiions inside your new page */]
    }
])
</script>

🎨 Styling

By the moment the only way to customize the command palette is with css variables:

CSS Variable Description
--command-palette-bg-color Background color of the command palette modal
--command-palette-border-radius Border radius of the command palette
--command-palette-border-color Border color of the command palette
--command-palette-backdrop-color Background color of the backdrop overlay
--command-palette-header-font-size Font size of the command palette header
--command-palette-header-bg-color Background color of the header
--command-palette-header-text-color Text color of the header
--command-palette-header-font-family Font family of the header
--command-palette-header-placeholder-color Text color of the placeholder text in the input field
--command-palette-icons-color Color of the icons in command items
--command-palette-items-selected Background color of selected items
--command-palette-items-font-size Font size of the command items
--command-palette-items-text-color Text color of the command items
--command-palette-items-font-family Font family of the command items
--command-palette-footer-bg-color Background color of the footer
--command-palette-keybinds-bg-color Background color of the keybinds section
--command-palette-footer-text-color Text color of the footer
--command-palette-footer-font-family Font family of the footer
--command-palette-keybinds-text-color Text color of the keybinds
--command-palette-keybinds-font-family Font family of the keybinds
--command-palette-keybinds-border-radius Border radius of the keybinds

🤝 Contributing

All contributions are welcome:

CONTRIBUTING.md

CODE_OF_CONDUCT.md

With 🧡 by Pau García Chiner

astro-command-palette's People

Contributors

pauchiner avatar dependabot[bot] avatar

Stargazers

Sova avatar Dirk Rathje avatar Connor Bär avatar Sergio Edo avatar Edgars Burtnieks avatar Daniel Báez avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.