Repository navigation
Conversation
…346, PR 3) `b.tabs(key, current, options).on_change(..).panel(|b, value| ..)`, behind a new `tabs` feature: a tab list that the arrows move through, and the panel of the selected tab, built lazily. - The list is a TabList group (`Nav::Row(Wrap::Around)`), one Tab stop on the selected tab; each tab a Tab item marked `selected`, the selected one `controls` its panel; the panel a TabPanel named by its tab. - Activation follows focus by default (`selection_follows_focus`); `.activate_on_enter()` leaves the arrows to move focus only. - The list and tabs draw in the segmented look, through `Style::segmented_track` / `segmented_cell` / `segmented_icon`; a tab without an icon is a span, as a segmented cell is. - Each panel is keyed by its tab, so a panel coming back finds its state. - `TabsStyle { gap }`: 8 pt between list and panel (shadcn's `gap-2`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o
A disabled cell's classes are already inert (Paint::classes), so the tab's own inert changed nothing; a test now disables the whole control. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o
This was referenced Nov 20, 2026
# Conflicts: # Cargo.toml # crates/eggshell-ui-extras/Cargo.toml
# Conflicts: # Cargo.toml # crates/eggshell-ui-extras/Cargo.toml
# Conflicts: # Cargo.toml # crates/eggshell-ui-extras/Cargo.toml
Owner
Author
|
Approved by the user after the Tabs trial (2026-11-19). GitHub's required checks pass on the branch merged with current main. Merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #346: PR 3 of the design note, the
tabswidget in extras. It builds on #368 (roving nav) and #425 (the segmented look as public classes).What
tabsfeature ineggshell-ui-extras.TabsExt::tabs(key, current, options)takes anythingIntoChoice<T>, assegmenteddoes, so icons, tooltips, disabled and refused options work unchanged. It is built on core's public API only..named(..): the tab list's accessible name..size(..),.enablement(..): as onsegmented, over what the subtree gives (Builder::control_size(),Builder::enablement())..activate_on_enter(): the arrows move focus only, and Enter or Space selects. By default the arrows select as they move..list_classes(..)and.panel_classes(..): merged over the list's and the panel's..on_change(..): required. It's a typestate, so.panelexists only after it..panel(|b, value| ..): terminal. It builds exactly the selected panel.TabList, named by.named.Tab,selectedon the current one.TabPanel, named by its tab's label.controlsits panel, through Core: NodeHandle::controls(Id), the aria-controls relation (part of #350) #381's relation. The unselected panels aren't built, so the other tabs name no panel.Nav::Row(Wrap::Around)group (Roving arrow keys for groups on the page; radio_group on them (#346, PR 1) #368). It is one Tab stop, on the selected tab, or on the first enabled tab when the selected one is disabled.TabsStyle { gap }: the 8 pt between the list and the panel. It's installed like the other extras' styles (TabsStyle::of,install_for).The look: the segmented control's, as decided
The list and the tabs draw through
Style::segmented_track,segmented_cellandsegmented_icon. A tab without an icon is a span, as a segmented cell is, so the nodes match one for one. A test checks every node's rect againstsegmented's, and the fills too.Each value, under the shadcn preset with
style-vega, against shadcn'stabs.tsx(apps/v4/registry/bases/radix/ui/tabs.tsx) andstyle-vega.css(.cn-tabs*):TabsStyle::gap8.cn-tabs { gap-2 }, in every style-*.csscontrol_height36.cn-tabs-listgroup-data-horizontal/tabs:h-9list_padding3.cn-tabs-listp-[3px]radius10.cn-tabs-listrounded-lgw_fitw-fitinputdefault: bg-mutedradius_md()8.cn-tabs-triggerrounded-mdcell_padding8 × 4.cn-tabs-triggerpx-2 py-1.cn-tabs-triggerborder border-transparent.cn-tabs-triggertext-sm font-medium.cn-tabs-triggergap-1.5icon_size16.cn-tabs-trigger[&_svg:not([class*='size-'])]:size-4grow()flex-1h-[calc(100%-1px)]backgroundfill,foregroundtextdata-active:bg-background data-active:text-foregroundinput/30fill,inputborder,foregroundtextdark:data-active:bg-input/30 dark:data-active:border-input dark:data-active:text-foregroundshadow_sm.cn-tabs-triggerdata-active:shadow-sm(default variant)muted_foregroundtext-foreground/60muted_foregrounddark:text-muted-foregroundhover:text-foreground(dark:hover:text-foreground)ring/50focus-visible:ring-[3px] focus-visible:ring-ring/50disabled:opacity-50.cn-tabs-content { text-sm }(text-xs/relaxedin lyra, which is each style's base)flex_1flex-1 outline-noneThe four ✗ are the segmented look's, kept as decided, for you to check:
input, notmuted;muted_foreground, notforeground/60;Changing them would change
segmentedtoo, or need aTabsStyleof its own. That's PR 4's render round, if you want it.Tests
New in
tests/it/tabs.rs, through kittest's real keys and pointer:roles::the_list_is_a_named_tablist_of_tabs_the_current_one_selectedroles::the_panel_is_named_by_its_tab_and_the_tab_controls_it: only the selected tab names a panel.pointer::a_click_selects_the_tab_and_its_panel_replaces_the_lastpointer::disabled_tabs_take_no_click: the whole control disabled.pointer::a_disabled_tab_does_not_selectkeyboard::the_list_is_one_tab_stop_on_the_selected_tab_and_tab_goes_on_into_the_panelkeyboard::the_arrows_select_as_they_move_and_wrap: one change per key.keyboard::home_and_end_go_to_the_endskeyboard::the_arrows_pass_over_a_disabled_tabkeyboard::up_and_down_do_nothingkeyboard::activated_on_enter_the_arrows_only_move_and_enter_selectspanels::only_the_selected_panel_is_builtpanels::a_panel_keeps_its_scroll_across_a_switch_away_and_backpanels::when_the_selected_tab_is_disabled_the_first_enabled_tab_is_the_stoplook::the_tab_list_draws_as_the_segmented_control_does: every node's rect, the list's fill and each tab's fill.Reversion check: on main the suite doesn't compile, because the feature is new. Each mutation below fails tests, and the unmutated branch passes all 15:
selected: 7 fail;controlsthe panel: 1 fails;One first-draft line made no difference and is gone: a disabled tab's own
inert(). The segmented cell classes are already inert when disabled (Paint::classes).Checks
cargo test -p eggshell-uipasses (lib 334,it1786), as do the extras' tests.TabsStyle.Breaking changes
None. A new feature.
TODO(prose)
The module doc,
TabsExt::tabs, everyTabsChainmethod,Unset,ChangesandTabsStylehave one-line drafts for you to rewrite.For you to try: this is a UI widget, so it gets a trial. That's PR 4, the gallery example, through the eggshell session. This PR has no example yet.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o