Skip to content

table: Allow a header row height separate from the body - #3420

Merged
madcodelife merged 2 commits into
longbridge:mainfrom
xhofe:table-header-height
Oct 9, 2026
Merged

madcodelife merged 2 commits into
longbridge:mainfrom
xhofe:table-header-height

Conversation

@xhofe

@xhofe xhofe commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

DataTable used one height for header rows and body rows, so a two-line header forced every record row to grow with it. header_row_height sets the height of each header row on its own. Body rows keep Size::table_row_height. When header_row_height is unset, header rows still use that body height, so existing tables look the same.

Page Up and Page Down used to subtract one body row as a stand-in for the header. They now subtract the full header band (header row height times the number of header rows) before dividing by the body row height. With a single header row at the body height, that is the same count as before.

Screenshot

No visual change when header_row_height is unset. The Data Table story adds a Header Row Height menu (Default / 40px / 48px) to try it.

Public API

gpui-component

  • gpui_component::table::DataTable::header_row_height(self, height: impl Into<gpui::Pixels>) -> Self — sets each header row's height independently of the body row size. Column-group rows use the same height. When unset, header rows keep Size::table_row_height().

How to Test

  • cargo check -p gpui-component --locked
  • cargo check -p gpui-component-story --locked (passed here)
  • cargo run and open the Data Table story. Scroll and use Page Up / Page Down. With Header Row Height on Default, the header and scrollbar match the previous build. Group Headers is on by default, so Page Up / Page Down now step one row less than before, because both header rows are subtracted. Switch Header Row Height to 40px or 48px to see taller header rows over unchanged body rows.
  • To try the new height: DataTable::new(&state).with_size(Size::Size(px(20.))).header_row_height(px(34.)). Header rows are 34px and body rows stay 20px. The vertical scrollbar starts below the header band.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific)

xhofe and others added 2 commits October 8, 2026 22:53
A taller header was forcing every body row to grow, because both bands used
Size::table_row_height. header_height sets the header band only. Page Up and
Page Down subtract that band before dividing by the body row height.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@madcodelife

Copy link
Copy Markdown
Member

Thanks for the PR!

I pushed a small follow-up. I renamed header_height to header_row_height, since the value sets the height of each header row, and also added a Header Row Height menu to the Data Table story so it's easy to try out.

@madcodelife
madcodelife enabled auto-merge (squash) October 9, 2026 03:25
@madcodelife
madcodelife disabled auto-merge October 9, 2026 03:25
@madcodelife
madcodelife enabled auto-merge (squash) October 9, 2026 03:25
@madcodelife
madcodelife merged commit 37cad32 into longbridge:main Oct 9, 2026
16 checks passed
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