Skip to main content

streamlit-image-board

Usage demo — select, hover, select-all, styled cards

Snappy React selectable image board for Streamlit, built on Components v2 (same stack as streamlit-drawable-konva).

Named image-board (not gallery) to avoid clashing with existing image-gallery packages. Checkboxes, image-frame selection, hover text, styled cards, and toolbar actions update inside the widget — no full Streamlit rerun for every toggle.

Features

  • CSS grid of image cards (configurable columns / gap)
  • Configurable image click: select | open | none (per item or board-wide)
  • Optional checkboxes kept in sync with the same selection
  • Select all / Deselect all + master All control
  • Hover text overlay on thumbnails
  • Stylable label / caption / text chips / buttons
  • Per-card (and board-default) background, text color, font
  • JSON items / full board config (file path, string, or dict)
  • Toolbar selection counter: file count + total size
  • Optional paging (page_size) — overflow goes to the next page; checklist spans all pages
  • Image-only cards via show_card_info=False (hide labels / captions / chips / card buttons)
  • Configurable button aesthetics (button_style, per-button variant / size / style)
  • Shared checklist contract for AgGrid (classic + v2)
  • Returns selected_ids: list[str], selected_csv, and size stats

Install

pip install streamlit-image-board
# or editable:
pip install -e .

Frontend rebuild (developers):

cd streamlit_image_board/frontend
npm install
npm run build

Demo:

streamlit run app.py

Bundled demo photos live in examples/images/ (public domain; see ATTRIBUTION.md). Refresh with uv run python scripts/fetch_demo_images.py.

Quick start

from streamlit_image_board import st_image_board

result = st_image_board(
    [
        {
            "id": "a",
            "src": "https://…",
            "label": "Alpha",
            "hover_text": "Alpha details on hover",
            "card_style": {
                "background": "#0f172a",
                "color": "#e2e8f0",
                "fontFamily": "Georgia, serif",
            },
            "texts": [
                {"text": "NEW", "variant": "badge"},
                {"text": "12 MB", "variant": "muted"},
            ],
        },
        {
            "id": "b",
            "image": pil_image,
            "label": "Beta",
            "caption": "from PIL",
            "background": "#fff7ed",
            "color": "#9a3412",
        },
    ],
    columns=4,
    selectable=True,
    image_click="select",  # or "open" / "none"
    show_select_all=True,
    selection_color="#0f766e",
    card_style={"background": "#ffffff", "color": "#0f172a"},  # board default
    buttons=[
        {"id": "approve", "label": "Approve", "variant": "primary"},
        {"id": "delete", "label": "Delete", "variant": "danger"},
    ],
    key="board",
)

ids = result.selected_ids   # ["a", "b"]
csv = result.selected_csv   # "a,b"
n = result.selected_count   # 2
size = result.selected_size # e.g. "240.0 KB" when sizes are known

Button aesthetics

Board-wide theme (toolbar, pager, card buttons):

result = st_image_board(
    items,
    button_style={
        "background": "#ffffff",
        "color": "#0f172a",
        "borderRadius": "999px",
        "padding": "6px 14px",
        "fontSize": "13px",
        "primaryBackground": "#0f766e",
        "primaryColor": "#ffffff",
        "dangerBackground": "#fee2e2",
        "dangerColor": "#b91c1c",
    },
    buttons=[
        {"id": "ok", "label": "Approve", "variant": "primary", "size": "lg"},
        {"id": "no", "label": "Skip", "variant": "ghost", "size": "sm"},
        {
            "id": "del",
            "label": "Delete",
            "variant": "danger",
            "style": {"fontWeight": "700"},
        },
    ],
)
Knob Values
variant default · primary · danger · ghost
size sm · md (default) · lg
style per-button sanitized CSS override
button_style board theme → CSS variables for all .sig-btn

Image-only cards

Hide everything under the thumbnail (label, caption, chips, per-card buttons):

result = st_image_board(items, show_card_info=False)

Checkboxes, hover overlay, selection frame, and toolbar actions still work.

Paging

Set page_size to a positive integer to paginate instead of scrolling. Selection, select-all, and the size counter stay global across pages.

result = st_image_board(
    items,
    columns=4,
    page_size=8,
    pager_position="top",  # or "bottom"
)
# page_size=0 (default) → classic scroll via max_height
# Pager controls: First / Prev / Next / Last

Selection size counter

Pass size / size_bytes on items (int bytes, or strings like "1.5 MB"). Pillow images and data: URLs get a size inferred automatically.

The toolbar shows e.g. 3 selected / 8 · 1.2 MB (toggle with show_selection_stats=False). Python side:

Field Meaning
selected_count Number of selected files
selected_bytes Sum of known sizes (bytes)
selected_size Human string ("" if none known)
result.stats_label(total_count=…) Same text as the toolbar
result = st_image_board(
    [
        {"id": "a", "src": "https://…/a.jpg", "size_bytes": 120_000},
        {"id": "b", "src": "https://…/b.jpg", "size": "2.1 MB"},
    ],
)
st.write(result.selected_count, result.selected_size)

Image click behavior

image_click Thumbnail click
"select" (default) Toggle selection frame (same checklist as checkboxes)
"open" Emit clicked_button="open" / clicked_item, and optionally window.open
"none" No thumbnail action (checkboxes / buttons still work)

Set board-wide via image_click=…, or per item with "image_click": "open".
Open target: item open_url / href / link, else src. Use open_in_new_tab=False to skip the browser tab and only emit the Streamlit event.

result = st_image_board(
    [
        {
            "id": "shot",
            "src": "https://…/thumb.jpg",
            "label": "Full size",
            "open_url": "https://…/full.jpg",
            "image_click": "open",
        }
    ],
    image_click="open",
    open_in_new_tab=True,
    selectable=True,       # checkboxes still select
    show_checkboxes=True,
)
if result.clicked_button == "open":
    st.write("Opened", result.clicked_item)

JSON input

Pass a path, JSON string, or dict — items only, or a full board config:

from streamlit_image_board import load_board_config, st_image_board

# Items array file (see examples/items.json)
result = st_image_board("examples/items.json", columns=3, image_click="select")

# Full config: items + options (kwargs override file fields)
result = st_image_board(config="examples/board_config.json")

# Or load yourself
cfg = load_board_config("examples/board_config.json")
result = st_image_board(**cfg, key="from_json")

Helpers: load_board_items, load_board_config.

Card chrome (font / background)

Source Keys
Board default card_style={...} on st_image_board
Per item card_style / style, or shortcuts background, color, font_family
Label / caption label_style, caption_style

Allowed style keys are sanitized (color, background, fontFamily, padding, …).

Selection UX

  • Click the image → depends on image_click (select / open / none)
  • Optional checkbox uses the same checklist (independent of open mode)
  • All / Select all / Deselect all in the toolbar
  • Hover shows hover_text (falls back to label)

BoardResult

Field Meaning
selected_ids list[str] — checkbox and image clicks
selected_csv Same ids as "id1,id2"
selected_count Number of selected files
selected_bytes Sum of known size_bytes
selected_size Human-readable total (or "")
clicked_button Last toolbar/card button id
clicked_item Item id for card button / activation
action_nonce Increments on each action so repeats are detectable

Helpers: result.as_list(), result.as_set(), result.stats_label(), result.to_aggrid_preselected(df), format_bytes.

st_image_gallery / GalleryResult remain as thin aliases.

AgGrid checklist bridge (classic + v2)

Shared contract: list[str] of stable ids (plus optional CSV). Both the image board and AgGrid read/write that checklist.

from st_aggrid import AgGrid, GridOptionsBuilder, GridUpdateMode
from streamlit_image_board import (
    configure_aggrid_selection,
    st_image_board,
    sync_checklist,
)

board = st_image_board(items, selected_ids=st.session_state.get("shared_selection", []))

gb = GridOptionsBuilder.from_dataframe(df)  # df must include an "id" column
configure_aggrid_selection(gb, st.session_state.get("shared_selection", []), data=df)
grid = AgGrid(df, gridOptions=gb.build(), update_mode=GridUpdateMode.SELECTION_CHANGED)

sel = sync_checklist(
    session_state=st.session_state,
    key="shared_selection",
    board=board,
    aggrid=grid,
    id_column="id",
)
Helper Role
normalize_selected_ids Coerce any payload → list[str]
selected_ids_from_aggrid Read AgGrid selected_rows
aggrid_preselected_rows Map ids → pre_selected_rows indices
configure_aggrid_selection Wire GridOptionsBuilder.configure_selection
sync_checklist Bidirectional session sync board ↔ AgGrid
filter_rows_by_ids Slice a DataFrame / row list by the checklist

Optional extras: pip install 'streamlit-image-board[aggrid]' or [aggrid-v2].

Publishing

Step-by-step GitHub / PyPI / Streamlit Cloud / gallery: PUBLISHING.md.

Refresh the usage GIF:

uv run python scripts/make_usage_gif.py
# or record from the live demo — see PUBLISHING.md

Requirements

  • Python ≥ 3.10
  • Streamlit ≥ 1.51 (Components v2)
  • Pillow
  • Node ≥ 18 (frontend build only)

Metadata

Release files for streamlit-image-board 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-image-board 0.1.0
File Size Uploaded Provenance Actions
streamlit_image_board-0.1.0.tar.gz 85.6 kB Without provenance Details for streamlit_image_board-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-image-board 0.1.0
File Interpreter ABI Platform Actions
streamlit_image_board-0.1.0-py3-none-any.whl Python 3 none any Details for streamlit_image_board-0.1.0-py3-none-any.whl

Total release size: 167.7 kB

Release files / streamlit_image_board-0.1.0.tar.gz

Download URL streamlit_image_board-0.1.0.tar.gz
Size 85.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bd24c411d4b32bcb4c09ed2be890efb01fc264f985bb9dafa2a1874a685f7034
BLAKE2b-256 checksum
How to use checksums
e93070a57613dc59211f8b7ca50c3b8fbdfa40f7a9f6dac984ef322aaef114e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / streamlit_image_board-0.1.0-py3-none-any.whl

Download URL streamlit_image_board-0.1.0-py3-none-any.whl
Size 82.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5adc7af02a626cffc34ce81ac9895724859d1b219a369ee29a7fcdf78e2d9ced
BLAKE2b-256 checksum
How to use checksums
6480b45ee5d9c4de693c0c3454bd5778da96c6f8e386aead3bfc42731df5b0b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for streamlit-image-board 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page