Skip to content

Conversation

@nojaf
Copy link
Contributor

@nojaf nojaf commented Sep 29, 2025

📝 Summary

Provides an alternative to hover_template for tables.
The main gripe with the template is that is was for the entire row and that turned out to be not flexible enough.

🔍 Description of Changes

Similar to style_cell we accept a callable to construct the hover text for a cell.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable). (Chatted with @mscolnick a bit)
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

@vercel
Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Sep 29, 2025 1:51pm

total_rows: Union[int, Literal["too_many"]]
cell_styles: Optional[CellStyles] = None
# Mapping of rowId -> columnName -> hover text (plain string)
cell_hover_texts: Optional[dict[RowId, dict[ColumnName, str]]] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe: Optional[dict[RowId, dict[ColumnName, Optional[str]]]] to allow for empty hover for cells

@mscolnick mscolnick merged commit ce09125 into marimo-team:main Sep 30, 2025
35 of 37 checks passed
@mscolnick mscolnick requested a review from Copilot September 30, 2025 03:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new callable hover template feature for tables, providing fine-grained control over cell hover text as an alternative to the existing string-based row-level hover templates.

  • Adds support for callable hover templates that compute plain-text hover titles for individual cells
  • Extends table functionality to handle per-cell hover text computation and display
  • Implements comprehensive test coverage for the new hover functionality

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
marimo/_plugins/ui/_impl/table.py Core implementation of callable hover templates with cell-level text computation
frontend/src/plugins/impl/DataTablePlugin.tsx Frontend integration for cell hover texts with type definitions and data flow
frontend/src/components/data-table/data-table.tsx Table component integration with new hover text feature
frontend/src/components/data-table/renderers.tsx Cell renderer updates to display hover titles
frontend/src/components/data-table/cell-hover-text/types.ts TypeScript type definitions for cell hover text functionality
frontend/src/components/data-table/cell-hover-text/feature.ts React Table feature implementation for cell hover text
tests/_plugins/ui/_impl/test_table.py Comprehensive test suite for the new hover functionality
examples/ui/table.py Example demonstrating the new callable hover template usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1356 to 1359
if args.sort and (self._style_cell or self._hover_cell):
LOGGER.warning(
"Cell styling is not correctly applied when table rows are sorted"
"Cell styling/hover may not be correctly applied when table rows are sorted"
)
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The warning message combines both styling and hover functionality, but they are separate features. Consider logging separate, more specific warnings for each feature when applicable.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,40 @@
/* Copyright 2024 Marimo. All rights reserved. */
"use no memo";
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directive should be 'use no memo' but appears to have a spacing issue. It should be written as a proper directive comment.

Suggested change
"use no memo";
// use no memo

Copilot uses AI. Check for mistakes.
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.

2 participants