Skip to content

UI: add check buttons that allow users to select multiple cells then … - #8000

Open
butterman28 wants to merge 1 commit into
jupyter:mainfrom
butterman28:feature/llm-cell-selector
Open

UI: add check buttons that allow users to select multiple cells then …#8000
butterman28 wants to merge 1 commit into
jupyter:mainfrom
butterman28:feature/llm-cell-selector

Conversation

@butterman28

Copy link
Copy Markdown

…a floating action button that has copy selected so you can copy the selected cells for llm context

feat: add LLM cell selector with floating copy button

References

Addresses the common workflow pain point of extracting specific cell contexts to feed into Large Language Models (LLMs), especially in environments like Kaggle where copying multiple disjointed cells is cumbersome.

This is a new additive feature. Unlike existing "Copy" commands that copy the entire notebook or a single active cell, this allows granular, multi-cell selection across the notebook with a dedicated, unobtrusive UI.

Code changes

  • packages/notebook-extension/src/index.ts: Added a new cellSelectorForLLM plugin.
    • Injects a checkbox into the prompt area of every cell.
    • Maintains a Map of selected cell IDs scoped to the specific NotebookPanel to prevent memory leaks and cross-tab confusion.
    • Listens to cells.changed to gracefully re-inject checkboxes if a cell's type changes or it is re-rendered.
    • Creates a Floating Action Button (FAB) appended to document.body that aggregates the source code of all selected cells, formats them with clear headers (e.g., --- CODE CELL ---), and writes them to the system clipboard using the navigator.clipboard API.
  • packages/notebook-extension/style/base.css: Added styling for:
    • .jp-LLMCellSelector: Styles the checkbox to match Jupyter's brand colors.
    • .jp-mod-selected-for-llm: Adds a subtle background color and left border to visually indicate a selected cell.
    • .jp-LLMFloatingCopyButton: Styles the floating pill-shaped button with hover effects, shadows, and a high z-index to ensure it remains accessible above all other UI elements.

User-facing changes

  • Checkboxes: A small, styled checkbox now appears to the left of the In [ ]: prompt on every cell.
  • Visual Feedback: When a cell is selected, it receives a subtle blue highlight and a left border, making it easy to see what will be copied.
  • Floating Action Button: A blue, pill-shaped "Copy Selected (N)" button floats in the bottom-right corner of the screen whenever a notebook is open.
  • Copy Feedback: Clicking the button copies the formatted text to the clipboard and briefly changes the button text to "✅ Copied to Clipboard!" for immediate user feedback. The button automatically hides when navigating away from the notebook view (e.g., back to the file browser).

(💡 Tip: Drag and drop a short screen recording or screenshot here showing the checkboxes and floating button in action!)

Backwards-incompatible changes

None. This is a purely additive, opt-in UI feature that does not modify any existing public APIs, default behaviors, or settings.

Screencast.From.2026-07-27.12-10-11.mp4

…a floating action button that has copy selected so you can copy the selected cells for llm context
@github-actions

Copy link
Copy Markdown
Contributor

Binder 👈 Launch a Binder on branch butterman28/jupyter_notebook/feature%2Fllm-cell-selector

@butterman28
butterman28 marked this pull request as draft July 27, 2026 11:24
@butterman28
butterman28 marked this pull request as ready for review July 27, 2026 11:27
@butterman28 butterman28 removed their assignment Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant