diff --git a/README.md b/README.md
index d6f9fe8..4d6f915 100644
--- a/README.md
+++ b/README.md
@@ -134,6 +134,8 @@ const c = new CommandPal({
placeholder: "Custom placeholder text...", // Changes placeholder text of input
debugOuput: false, // if true report debugging info to console
hideButton: false, // if true, do not generate mobile button
+ footerText: null, // Text to display in the footer of the palette.
+ // If null (default), do not add footer.
commands: [
// Commands go here
]
@@ -232,6 +234,10 @@ The styles used by command-pal are included in the package. However you can over
#CommandPal [slot=items] { background-color: yellow;}
/* item text */
#CommandPal .item { color:black; }
+ /* footers (optional) in all command-pal instances */
+ .footer[slot=footer] { background-color: gold; color: black;}
+ /* explicitly override footer styling for one instance */
+ #CommandPal .footer { background-color: gold; color: black;}
```
You can also assign a custom `id` to the CommandPal instance.
diff --git a/public/cp-advanced/index.html b/public/cp-advanced/index.html
index 23ea677..a137dc8 100644
--- a/public/cp-advanced/index.html
+++ b/public/cp-advanced/index.html
@@ -84,6 +84,7 @@
Output Events
hotkey: "ctrl+space",
hotkeysGlobal: true,
placeholder: "Custom placeholder text...",
+ footerText: "Click background, press ESC key or ctrl+space to close.",
commands: [
{
name: "Toggle Dark/Light Theme",
diff --git a/public/cp-advanced/local-dev.html b/public/cp-advanced/local-dev.html
index 4ff602f..b4d9dcf 100644
--- a/public/cp-advanced/local-dev.html
+++ b/public/cp-advanced/local-dev.html
@@ -68,6 +68,7 @@ Output
const c = new CommandPal({
id: 'MyCommandPal',
hotkey: "ctrl+space",
+ footerText: "Click background or press ESC key to close.",
commands: [
{
name: "Toggle Dark/Light Theme",
diff --git a/src/App.svelte b/src/App.svelte
index a694518..0c71177 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -19,6 +19,7 @@
export let placeholderText;
export let hideButton;
export let paletteId;
+ export let footerText;
const optionsFuse = {
isCaseSensitive: false,
@@ -160,5 +161,14 @@
{selectedIndex}
on:clickedIndex={onClickedIndex} />
+
+
diff --git a/src/PaletteContainer.svelte b/src/PaletteContainer.svelte
index c3e01dd..36d53bf 100644
--- a/src/PaletteContainer.svelte
+++ b/src/PaletteContainer.svelte
@@ -42,6 +42,14 @@
.search-box {
padding: 7px;
}
+ :global(.footer) {
+ background-color: rgba(0, 0, 0, 0.33);
+ border-block-start: black ridge 2px;
+ color: #ddd;
+ font-size: smaller;
+ padding-block-start: 0.1em;
+ padding-inline: 0.5em;
+ }
/* .search:focus {
color: white;
} */
@@ -55,6 +63,7 @@
+
diff --git a/src/main.js b/src/main.js
index 8e86ccc..565a08d 100644
--- a/src/main.js
+++ b/src/main.js
@@ -19,6 +19,7 @@ class CommandPal {
placeholderText: this.options.placeholder || "What are you looking for?",
hotkeysGlobal: this.options.hotkeysGlobal || false,
hideButton: this.options.hideButton || false,
+ footerText: this.options.footerText || null,
},
});
const ctx = this;