0.1.3 β€’ Published 1 year ago

astro-command-palette v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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 VariableDescription
--command-palette-bg-colorBackground color of the command palette modal
--command-palette-border-radiusBorder radius of the command palette
--command-palette-border-colorBorder color of the command palette
--command-palette-backdrop-colorBackground color of the backdrop overlay
--command-palette-header-font-sizeFont size of the command palette header
--command-palette-header-bg-colorBackground color of the header
--command-palette-header-text-colorText color of the header
--command-palette-header-font-familyFont family of the header
--command-palette-header-placeholder-colorText color of the placeholder text in the input field
--command-palette-icons-colorColor of the icons in command items
--command-palette-items-selectedBackground color of selected items
--command-palette-items-font-sizeFont size of the command items
--command-palette-items-text-colorText color of the command items
--command-palette-items-font-familyFont family of the command items
--command-palette-footer-bg-colorBackground color of the footer
--command-palette-keybinds-bg-colorBackground color of the keybinds section
--command-palette-footer-text-colorText color of the footer
--command-palette-footer-font-familyFont family of the footer
--command-palette-keybinds-text-colorText color of the keybinds
--command-palette-keybinds-font-familyFont family of the keybinds
--command-palette-keybinds-border-radiusBorder radius of the keybinds

🀝 Contributing

All contributions are welcome:

CONTRIBUTING.md

CODE_OF_CONDUCT.md

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago