Skip to content

[DS 2.0] Rebuild NavButton, add MenuTriggerButton - #92

Open
librowski wants to merge 6 commits into
ds2-repointfrom
ds2-nav-button
Open

[DS 2.0] Rebuild NavButton, add MenuTriggerButton#92
librowski wants to merge 6 commits into
ds2-repointfrom
ds2-nav-button

Conversation

@librowski

Copy link
Copy Markdown
Collaborator

Rebuilds NavButton on the same shape as the new Button and adds MenuTriggerButton.

APIsize, styleVariant and explicit prefixIcon/suffixIcon slots. The label/icon/icon+label subtypes are gone, and with them the shared children-shape guards: nothing imports them any more, so guards.ts and its spec are deleted.

Selected is not pressed — this is the point of the layer. Selection (isSelected) survives hover, and pointer-down overrides it; each state draws its own token, exactly as the design defines and as the token export ships (nav-button-bg-primary-{default,hover,pressed,active,focus,disabled}).

Sizes — seven steps from the design set: boxes 48/42/36/32/28/24/20, icon-only padding 12/11/9/7/6/6/4, gap 8 (6 for the two smallest), radius 8/8/6/4/4/4/4, icon boxes 24/20/18/18/16/12/12. Nav labels keep the regular weight, unlike the emphasized button labels. styleVariant: 'plain' is the design's "no background" treatment — transparent by default, still lit on the other states.

MenuTriggerButton — new, composes NavButton and maps isOpen onto selection.

SegmentPicker keeps its public API: it consumed NavButton's subcomponent prop types, and now translates its own long-form sizes and shapes to the new slots internally.

Verified at the tip of the stack (so this covers the four layers below it): ui/sdk lint + typecheck, build:ui, build:lib, stylelint, all test suites, docs build (211 pages), demo build.

@librowski
librowski force-pushed the ds2-nav-button branch 2 times, most recently from 7948a91 to 679672c Compare August 24, 2026 07:10
@librowski librowski changed the title Rebuild NavButton, add MenuTriggerButton [DS 2.0] Rebuild NavButton, add MenuTriggerButton Aug 26, 2026
@librowski
librowski marked this pull request as ready for review August 27, 2026 14:17

return (
<NavButton
aria-label={context?.isExpanded ? 'Collapse' : 'Expand'}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should use i18n instead of hardcoded labels

<X />
</NavButton>
)}
{onClose && <NavButton aria-label="Close" onClick={onClose} prefixIcon={<X />} />}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The same here. aria-label="Close"

NavButton takes size, styleVariant and explicit icon slots, so the
label/icon/icon+label subtypes and the shared children-shape guards are
gone - nothing imports them any more, so they are deleted too.

The selected state and the mouse-down state are now separate: selection
survives hover and pointer-down overrides it, each on its own token,
which is what the design defines and what the token export ships.

Seven sizes carry the design's boxes, padding, gap, radius and icon
boxes; nav labels keep the regular weight. MenuTriggerButton composes
NavButton and maps its open state onto selection.

SegmentPicker keeps its public API and translates to the new slots
internally.
SegmentPicker accepted an icon, a label, or a mix of both as children;
the slot rewrite only handled the single-element form, so mixed content
lost its icon treatment. Children are normalised into slots again, the
selected segment reports its state to assistive technology, and
clicking it no longer emits a change it used to swallow.

NavButton's props became a union: a label button with optional icons,
or an icon button that requires its icon. Neither form can now be
written so that it renders nothing.

The visual treatment prop is called variant, matching the other
components. The language selector lets the button own its label
typography instead of composing a retired global class, and the two
style modules the rebuild orphaned are gone.
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