Skip to content

feat(scrollbar)!: WIP - Refactored and added scrollbar component style with defaults#201

Draft
vijayprakashpj wants to merge 8 commits into
ratatui:mainfrom
vijayprakashpj:main
Draft

feat(scrollbar)!: WIP - Refactored and added scrollbar component style with defaults#201
vijayprakashpj wants to merge 8 commits into
ratatui:mainfrom
vijayprakashpj:main

Conversation

@vijayprakashpj

@vijayprakashpj vijayprakashpj commented Mar 8, 2026

Copy link
Copy Markdown
  • Encapsulate track, thumb and arrow styles into a struct.
  • Implemented builder methods, default styles based on existing implementation

Fixes #193

- Encapsulate track, thumb and arrow styles into a struct.
- Implemented builder methods, default styles based on existing implementation
…scriptions, method comments, and a usage example.
@vijayprakashpj vijayprakashpj changed the title feat(scrollbar)!: Added scrollbar component style with defaults feat(scrollbar)!: WIP - Refactored and added scrollbar component style with defaults Mar 8, 2026
@orhun

orhun commented Mar 9, 2026

Copy link
Copy Markdown
Member

lmk when this is ready for review

@joshka

joshka commented Jun 11, 2026

Copy link
Copy Markdown
Member

Thanks for working on this. I dug into the original issue in #193 and left a note there: the style values are currently hardcoded only as defaults, and the existing track_style, thumb_style, and arrow_style builder methods already allow callers to override them.

Given that, I’m not sure this PR is necessary as a fix for #193. The remaining question is whether we want a grouped ScrollBarStyle type as a separate convenience API for reusing a complete scrollbar theme across multiple scrollbars. If there is a specific use case for that, it would be good to frame this PR around that use case rather than around making styling possible in the first place.

I do think there is a discoverability problem here, though. The existing styling methods should probably get a clearer example and better docs, since it was easy to miss them when looking at the default values in ScrollBar::new.

joshka added a commit that referenced this pull request Jun 11, 2026
## Summary

- Improve `tui-scrollbar` crate docs for API discovery, styling
behavior, glyph selection, and interaction flow.
- Add a small `scrollbar_styled` example that shows distinct track,
thumb, and arrow styles for vertical and horizontal scrollbars.
- Configure docs.rs example scraping and add a regression test for
custom thumb styling on full and partial thumb cells.

## Details

This is a non-functional docs/examples/tests change. It reorganizes the
crate-level docs so important defaults and caveats are visible earlier,
replaces the loose `ScrollBar` “Key methods” list with a grouped method
map, and adds canonical examples for the main builder methods.

The styling docs now spell out how `fg` and `bg` apply to terminal glyph
cells. In particular, they call out that the default minimal track
renders spaces, so empty track cells show background color, while
visible glyph sets can use foreground color for the track line. The docs
also note the partial-thumb caveat: when using visible tracks such as
`GlyphSet::box_drawing`, thumb background can show at partial glyph
edges, so matching it to the track background is usually less
surprising.

The glyph docs keep repeated `Symbols for Legacy Computing` context
where readers may land directly, rather than relying on linear reading
through the crate docs.

Related context:

- Issue #193: #193
- PR #201: #201

## Validation

- `cargo test -p tui-scrollbar --all-features`
- `cargo test -p tui-scrollbar --doc --all-features`
- `cargo check -p tui-scrollbar --examples --all-features`
- `cargo clippy -p tui-scrollbar --all-targets --all-features`
- `RUSTDOCFLAGS='-D warnings' cargo doc -p tui-scrollbar --no-deps
--all-features`
- `just fmt-check`
- `cargo rdme --check --manifest-path tui-scrollbar/Cargo.toml`
- `markdownlint-cli2 tui-scrollbar/README.md`
joshka pushed a commit that referenced this pull request Jun 11, 2026
## 🤖 New release

* `tui-scrollbar`: 0.2.5 -> 0.2.6 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.2.6] - 2026-06-11

### 📚 Documentation

- *(scrollbar)* Improve API discovery
([#251](#251))
  > ## Summary
  >
  > - Improve `tui-scrollbar` crate docs for API discovery, styling
  > behavior, glyph selection, and interaction flow.
  > - Add a small `scrollbar_styled` example that shows distinct track,
  > thumb, and arrow styles for vertical and horizontal scrollbars.
  > - Configure docs.rs example scraping and add a regression test for
  > custom thumb styling on full and partial thumb cells.
  >
  > ## Details
  >
> This is a non-functional docs/examples/tests change. It reorganizes
the
> crate-level docs so important defaults and caveats are visible
earlier,
> replaces the loose `ScrollBar` “Key methods” list with a grouped
method
  > map, and adds canonical examples for the main builder methods.
  >
> The styling docs now spell out how `fg` and `bg` apply to terminal
glyph
  > cells. In particular, they call out that the default minimal track
  > renders spaces, so empty track cells show background color, while
> visible glyph sets can use foreground color for the track line. The
docs
> also note the partial-thumb caveat: when using visible tracks such as
  > `GlyphSet::box_drawing`, thumb background can show at partial glyph
  > edges, so matching it to the track background is usually less
  > surprising.
  >
  > The glyph docs keep repeated `Symbols for Legacy Computing` context
> where readers may land directly, rather than relying on linear reading
  > through the crate docs.
  >
  > Related context:
  >
  > - Issue #193: #193
  > - PR #201: #201
  >
  > ## Validation
  >
  > - `cargo test -p tui-scrollbar --all-features`
  > - `cargo test -p tui-scrollbar --doc --all-features`
  > - `cargo check -p tui-scrollbar --examples --all-features`
  > - `cargo clippy -p tui-scrollbar --all-targets --all-features`
  > - `RUSTDOCFLAGS='-D warnings' cargo doc -p tui-scrollbar --no-deps
  > --all-features`
  > - `just fmt-check`
  > - `cargo rdme --check --manifest-path tui-scrollbar/Cargo.toml`
  > - `markdownlint-cli2 tui-scrollbar/README.md`
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
joshka pushed a commit that referenced this pull request Jun 12, 2026
## 🤖 New release

* `tui-widgets`: 0.7.4 -> 0.7.5 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.7.5] - 2026-06-11

### 📚 Documentation

- *(scrollbar)* Improve API discovery
([#251](#251))
  > ## Summary
  >
  > - Improve `tui-scrollbar` crate docs for API discovery, styling
  > behavior, glyph selection, and interaction flow.
  > - Add a small `scrollbar_styled` example that shows distinct track,
  > thumb, and arrow styles for vertical and horizontal scrollbars.
  > - Configure docs.rs example scraping and add a regression test for
  > custom thumb styling on full and partial thumb cells.
  >
  > ## Details
  >
> This is a non-functional docs/examples/tests change. It reorganizes
the
> crate-level docs so important defaults and caveats are visible
earlier,
> replaces the loose `ScrollBar` “Key methods” list with a grouped
method
  > map, and adds canonical examples for the main builder methods.
  >
> The styling docs now spell out how `fg` and `bg` apply to terminal
glyph
  > cells. In particular, they call out that the default minimal track
  > renders spaces, so empty track cells show background color, while
> visible glyph sets can use foreground color for the track line. The
docs
> also note the partial-thumb caveat: when using visible tracks such as
  > `GlyphSet::box_drawing`, thumb background can show at partial glyph
  > edges, so matching it to the track background is usually less
  > surprising.
  >
  > The glyph docs keep repeated `Symbols for Legacy Computing` context
> where readers may land directly, rather than relying on linear reading
  > through the crate docs.
  >
  > Related context:
  >
  > - Issue #193: #193
  > - PR #201: #201
  >
  > ## Validation
  >
  > - `cargo test -p tui-scrollbar --all-features`
  > - `cargo test -p tui-scrollbar --doc --all-features`
  > - `cargo check -p tui-scrollbar --examples --all-features`
  > - `cargo clippy -p tui-scrollbar --all-targets --all-features`
  > - `RUSTDOCFLAGS='-D warnings' cargo doc -p tui-scrollbar --no-deps
  > --all-features`
  > - `just fmt-check`
  > - `cargo rdme --check --manifest-path tui-scrollbar/Cargo.toml`
  > - `markdownlint-cli2 tui-scrollbar/README.md`

### ⚙️ Miscellaneous Tasks

- *(tui-scrollbar)* Release v0.2.6
([#258](#258))
  > ## 🤖 New release
  >
  > * `tui-scrollbar`: 0.2.5 -> 0.2.6 (✓ API compatible changes)
  >
  > <details><summary><i><b>Changelog</b></i></summary><p>
  >
  > <blockquote>
  >
  > ## [0.2.6] - 2026-06-11
  >
  > ### 📚 Documentation
  >
  > - *(scrollbar)* Improve API discovery
  > ([#251](#251))
  >   > ## Summary
  >   >
  >   > - Improve `tui-scrollbar` crate docs for API discovery, styling
  >   > behavior, glyph selection, and interaction flow.
> > - Add a small `scrollbar_styled` example that shows distinct track,
  >   > thumb, and arrow styles for vertical and horizontal scrollbars.
> > - Configure docs.rs example scraping and add a regression test for
  >   > custom thumb styling on full and partial thumb cells.
  >   >
  >   > ## Details
  >   >
> > This is a non-functional docs/examples/tests change. It reorganizes
  > the
  > > crate-level docs so important defaults and caveats are visible
  > earlier,
  > > replaces the loose `ScrollBar` “Key methods” list with a grouped
  > method
  >   > map, and adds canonical examples for the main builder methods.
  >   >
  > > The styling docs now spell out how `fg` and `bg` apply to terminal
  > glyph
> > cells. In particular, they call out that the default minimal track
> > renders spaces, so empty track cells show background color, while
> > visible glyph sets can use foreground color for the track line. The
  > docs
> > also note the partial-thumb caveat: when using visible tracks such
as
> > `GlyphSet::box_drawing`, thumb background can show at partial glyph
  >   > edges, so matching it to the track background is usually less
  >   > surprising.
  >   >
> > The glyph docs keep repeated `Symbols for Legacy Computing` context
> > where readers may land directly, rather than relying on linear
reading
  >   > through the crate docs.
  >   >
  >   > Related context:
  >   >
  >   > - Issue #193: #193
  >   > - PR #201: #201
  >   >
  >   > ## Validation
  >   >
  >   > - `cargo test -p tui-scrollbar --all-features`
  >   > - `cargo test -p tui-scrollbar --doc --all-features`
  >   > - `cargo check -p tui-scrollbar --examples --all-features`
  >   > - `cargo clippy -p tui-scrollbar --all-targets --all-features`
> > - `RUSTDOCFLAGS='-D warnings' cargo doc -p tui-scrollbar --no-deps
  >   > --all-features`
  >   > - `just fmt-check`
  >   > - `cargo rdme --check --manifest-path tui-scrollbar/Cargo.toml`
  >   > - `markdownlint-cli2 tui-scrollbar/README.md`
  > </blockquote>
  >
  >
  > </p></details>
  >
  > ---
  > This PR was generated with
  > [release-plz](https://github.com/release-plz/release-plz/).
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Support styling for scrollbar widgets

3 participants