Skip to content

Tabs: Add support for adding buttons before the left arrow in the tab bar. - #131

Open
SpruceCloud wants to merge 3 commits into
rerun-io:mainfrom
SpruceCloud:tab-bar-custom-slots
Open

Tabs: Add support for adding buttons before the left arrow in the tab bar.#131
SpruceCloud wants to merge 3 commits into
rerun-io:mainfrom
SpruceCloud:tab-bar-custom-slots

Conversation

@SpruceCloud

@SpruceCloud SpruceCloud commented May 18, 2026

Copy link
Copy Markdown
Contributor

Adding support for custom buttons before the left arrow into the tab bar. The additional buttons can be used e.g. for a button to add new custom tab or an action search among tabs.

  • tab_bar_left_ui — left of the left scroll-arrow

@lucasmerlin lucasmerlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Comment thread src/behavior.rs
@lucasmerlin lucasmerlin added the enhancement New feature or request label Jun 26, 2026
@SpruceCloud
SpruceCloud force-pushed the tab-bar-custom-slots branch from 3eeac1d to 08daa8a Compare June 26, 2026 17:19
Two new `Behavior` trait methods with no-op defaults let consumers inject
custom UI into the tab bar pinned to the outer edges:

- `tab_bar_leading_ui`  — left of the left scroll-arrow
- `tab_bar_trailing_ui` — right of `top_bar_right_ui` and the right scroll-arrow

Both slots sit outside the scrollable tab strip, so they don't move when
tabs are scrolled. Their consumed width is automatically subtracted from
the area available to the tab strip (via `ui.available_width()` shrinking
before `ScrollState::update` reads it), so tabs shrink rather than
overlap. `scroll_area_width` is additionally clamped against the inner
LTR ui's remaining width so the leading slot is handled the same way.

`top_bar_right_ui` is unchanged — the new trailing slot lives further
outside it.

The `advanced` example gains a hamburger (☰) leading and a gear (⚙)
trailing widget to demonstrate the pinning behavior.
Bare `let _ = ui.small_button(...)` tripped `clippy::let_underscore_must_use`
and `clippy::let_underscore_untyped`. Renaming to `let _response` silences
both while keeping the discard intent.
@SpruceCloud
SpruceCloud force-pushed the tab-bar-custom-slots branch from 08daa8a to edbb3d8 Compare June 26, 2026 17:23
@SpruceCloud SpruceCloud changed the title Tabs: Add support for adding buttons before the left arrow and after the right arrow into the tab bar. Tabs: Add support for adding buttons before the left arrow in the tab bar. Jun 26, 2026
@emilk emilk added the include in changelog Include this in CHANGELOG.md label Jul 27, 2026
@emilk
emilk requested a review from lucasmerlin July 27, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request include in changelog Include this in CHANGELOG.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants