A Cmd/Ctrl-K command palette and global search overlay for Streamlit apps.
Project description
streamlit-command-palette
streamlit-command-palette adds a polished Cmd/Ctrl-K command palette and
global search overlay to Streamlit apps.
It is intentionally small for v1: local client-side fuzzy search, grouped results, keyboard and mouse selection, and a simple Python API. It does not add AI search, database search, auth, or server-side search.
Installation
pip install streamlit-command-palette
Streamlit Custom Components v2 is required, so the package depends on
streamlit>=1.54.0 and Python >=3.10.
Quickstart
import streamlit as st
from streamlit_command_palette import action_item, command_palette, page_item
items = [
page_item("home", "Home", subtitle="Overview", target="Home.py"),
page_item("reports", "Reports", subtitle="Saved reporting views"),
action_item("refresh", "Refresh data", subtitle="Run the latest query"),
{
"id": "docs",
"title": "Open documentation",
"subtitle": "Project README and runbook",
"type": "link",
"group": "Resources",
"url": "https://example.com/docs",
"keywords": ["help", "manual", "reference"],
},
]
selected = command_palette(items, key="global_palette")
if selected:
st.write("Selected:", selected)
if selected["id"] == "refresh":
st.cache_data.clear()
st.rerun()
The component opens with Cmd+K on macOS and Ctrl+K elsewhere when using the
default shortcut="mod+k".
API
from streamlit_command_palette import (
action_item,
command_palette,
command_search,
dataframe_items,
page_item,
)
command_palette(
items,
placeholder="Search...",
shortcut="mod+k",
open=False,
groups=None,
max_results=10,
min_query_length=0,
search_fields=None,
show_shortcut_hint=True,
empty_state="No results found",
key=None,
height=None,
theme=None,
)
command_palette returns the selected item dictionary on the Streamlit rerun
caused by selection, or None when nothing was selected.
command_search remains available as an alias for compatibility.
Item schema
Each item supports these fields:
| Field | Required | Description |
|---|---|---|
id |
yes | Stable unique item id. |
title |
yes | Primary result label. |
subtitle |
no | Secondary text below the title. |
type |
no | Item type such as page, action, dataframe, or link. |
group |
no | Group heading for grouped results. |
target |
no | JSON-safe value returned to Python for your app logic. |
url |
no | URL metadata returned to Python. |
icon |
no | Short label or icon text. Built-ins: page, action, dataframe, link. |
keywords |
no | Extra searchable terms. |
metadata |
no | JSON-safe metadata, also searchable by default. |
disabled |
no | Disabled items are shown but cannot be selected. |
Helpers
page_item("analytics", "Analytics", target="pages/1_Analytics.py")
action_item("clear-cache", "Clear cache", target="clear-cache")
items = dataframe_items(
df,
id_field="customer_id",
title_field="customer_name",
subtitle_fields=["segment", "region"],
group="Customers",
)
Group ordering and labels
Pass groups to control display order and labels:
selected = command_palette(
items,
groups={
"Pages": "Pages",
"Actions": "Actions",
"Customers": {"title": "Customers"},
},
)
Search fields
By default, the frontend searches title, subtitle, keywords, and
metadata. You can override the fields:
command_palette(
items,
search_fields=["title", "keywords", "metadata.owner"],
min_query_length=1,
)
Theming
The component uses Streamlit theme CSS variables automatically. You can pass a small override mapping when needed:
command_palette(
items,
theme={
"primaryColor": "#0f766e",
"borderColor": "rgba(148, 163, 184, 0.35)",
},
)
Keyboard support
The overlay supports:
Cmd+Kon macOS andCtrl+Kelsewhere by defaultEscapeto closeEnterto selectArrowUpandArrowDownto moveHomeandEndto jump
Examples
Run any example with Streamlit:
streamlit run examples/basic.py
streamlit run examples/actions.py
streamlit run examples/dataframe.py
streamlit run examples/multipage/Home.py
Development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
cd src/streamlit_command_palette/frontend
npm install
npm run build
cd ../../../..
pytest
python -m build
The package includes a prebuilt frontend/build/index.js asset so users do not
need Node.js to install or run the component.
Release checklist
- Update the version in the root
pyproject.toml, package__init__.py, and component-levelpyproject.toml. - Build the frontend from
src/streamlit_command_palette/frontend. - Run
pytest. - Run
python -m build. - Run
python -m twine check dist/*. - Publish from GitHub Actions using the included TestPyPI and PyPI workflows.
GitHub Actions workflows are included for pull request CI, manual TestPyPI publishing, and PyPI publishing from GitHub releases.
Contributing and security
See CONTRIBUTING.md for development setup and pull request expectations.
See SECURITY.md for vulnerability reporting.
See CODE_OF_CONDUCT.md for community expectations.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_command_palette-0.1.0.tar.gz.
File metadata
- Download URL: streamlit_command_palette-0.1.0.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85db8ce2d0826330933669bd894c547b612c2645dba953634b9c622fcfd93887
|
|
| MD5 |
cafb2a803d02fb44d737c451e445b9f1
|
|
| BLAKE2b-256 |
54a96cf38c614753cf40888a5d6377d5f02d1a86b3adab6ed587b8c269283274
|
Provenance
The following attestation bundles were made for streamlit_command_palette-0.1.0.tar.gz:
Publisher:
release.yml on huss22/streamlit-command-palette
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streamlit_command_palette-0.1.0.tar.gz -
Subject digest:
85db8ce2d0826330933669bd894c547b612c2645dba953634b9c622fcfd93887 - Sigstore transparency entry: 1741016355
- Sigstore integration time:
-
Permalink:
huss22/streamlit-command-palette@a7bbf18f07c5505b278ed62c230b3cf01d678806 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/huss22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a7bbf18f07c5505b278ed62c230b3cf01d678806 -
Trigger Event:
release
-
Statement type:
File details
Details for the file streamlit_command_palette-0.1.0-py3-none-any.whl.
File metadata
- Download URL: streamlit_command_palette-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b114e4f53710edd01ec6207427d90fc68ce251bc96ebeb8a74c0e60b49f9776
|
|
| MD5 |
562402aadaed14982f83f66cc22430c4
|
|
| BLAKE2b-256 |
089504a637f589b362614ea1728c8236fb93b4e01c1dcf31e6deb9f78cb79cc6
|
Provenance
The following attestation bundles were made for streamlit_command_palette-0.1.0-py3-none-any.whl:
Publisher:
release.yml on huss22/streamlit-command-palette
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streamlit_command_palette-0.1.0-py3-none-any.whl -
Subject digest:
2b114e4f53710edd01ec6207427d90fc68ce251bc96ebeb8a74c0e60b49f9776 - Sigstore transparency entry: 1741016362
- Sigstore integration time:
-
Permalink:
huss22/streamlit-command-palette@a7bbf18f07c5505b278ed62c230b3cf01d678806 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/huss22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a7bbf18f07c5505b278ed62c230b3cf01d678806 -
Trigger Event:
release
-
Statement type: