zed/crates/ui
Oleksandr Kholiavko dca5976f82
csv_preview: Implement data_table columns pining (#56619)
## Summary

Adds column pinning (freeze) capability to data tables, allowing the
first N columns to remain visible while scrolling horizontally through
the rest of the table content.

Common spreadsheet/data table UX pattern. When viewing wide tables with
many columns, users need to see identifying information (row labels,
IDs) while scrolling right to explore data.

## Demo
Idle state:
<img width="559" height="179" alt="image"
src="https://github.com/user-attachments/assets/b3f89221-8aa9-4e8a-9a39-6f06cc8a4eea"
/>
Scrolled horizontally (name column dissapeared, line numbers column
stayed pinned):
<img width="522" height="174" alt="image"
src="https://github.com/user-attachments/assets/c6695a00-5e40-49b8-81d7-0b30e26bb7bb"
/>

## Implementation

- New `pin_cols(n: usize)` builder method on `Table` to specify how many
columns to pin
- Pinned columns render in a fixed section that doesn't scroll
horizontally
- Scrollable columns render separately with independent scroll state
- Horizontal scroll offset adjustments for proper column resize handle
positioning with pinned sections
- Pinned section stays at viewport left edge while scrollable section
scrolls independently
- Supports 0 < pinned_cols < total_cols (partial pinning)
- Applied to CSV preview for better UX with wide datasets

## Context

Part of CSV preview feature series, following PR #53496 (settings UI).

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] ~~Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)~~
no ui changes besides pinning itself. UI improvements out of scope of
this PR

Release Notes:

- Improved CSV preview with column pinning to keep identifiers visible
while scrolling

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-05-15 11:12:41 +00:00
..
src csv_preview: Implement data_table columns pining (#56619) 2026-05-15 11:12:41 +00:00
Cargo.toml Remove storybook and story crates (#53511) 2026-04-09 12:32:27 +00:00
LICENSE-GPL