Skip to content

fix(site): docs demos use real parts; InputGroupToggle; demo intervals stop (#97) - #164

Merged
aayushbtw merged 9 commits into
ui-sdkfrom
fix/demos-real-parts
Nov 21, 2026
Merged

aayushbtw merged 9 commits into
ui-sdkfrom
fix/demos-real-parts

Conversation

@aayushbtw

@aayushbtw aayushbtw commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Why

The goal for the ui-sdk branch is to fix every bug we can fix on our side. This PR covers the docs demos. AGENTS.md says a demo must never fake a component with a native element or hand-rolled styles. Every part these demos faked now exists, so the demos use the real parts. Agents then see real controls in snapshot(), and readers copy the real pattern. It also fixes #97, the mention half of #52, and a regression from #142 in the sidebar demo.

What

  • Toggle in an input group. The voice mode (Button Group) and Favorite (Input Group) controls were InputGroupButtons with a hand-set aria-pressed. Our Toggle can't render through InputGroupButton: two styled parts on one element make withStyles throw. Rendering ui-sdk's Toggle through it put two entries for one element in snapshot() (button and toggle), the same defect ARCHITECTURE.md records for Command. So this PR adds InputGroupToggle, a new public part. It is our Toggle with data-input-group-button, sized sm, icon-xs (default) or icon-sm, and it has no variant. styles.button is split into action (both parts) and button (boxShadow: none, InputGroupButton only), so the toggle keeps its pressed fill. The registry item gains toggle. Docs: a Toggle section and an API row in input-group.md, and button-group.md is updated.
  • Theme picker. The preset Buttons (secondary when picked) are now a ToggleGroup named "Theme", single-select with deselectable={false}.
  • Scroll Area, both axes. The demo used a native <table> with hand-rolled cells. Our Table owns its own horizontal scroller. Inside the demo's area, the outer viewport only scrolled down (382x238 visible, 382x321 content) and the table scrolled sideways itself (737 wide). So the demo now scrolls a 6-column grid of the page's existing tiles (880x720 content). The snippet is updated.
  • Button Group text. The native <label> is now ui-sdk's unstyled Label rendered by ButtonGroupText, which draws it. Our Label is styled, so it would throw. The oxlint-disable comment is gone.
  • Mobile nav. Group rows are ui-sdk's unstyled Button with the same row styles, as Sidebar's rows are. The sibling TanStack Router Link rows stay as they are. This is site chrome, not a demo.
  • Hover Card (Hover Card demos spread stylex.props into HoverCardTrigger instead of sx #52). The mention uses sx={styles.mention}. The buttonStyles spreads at hover-card.tsx:104/110 are left alone, because they are the documented style-getter pattern (ARCHITECTURE.md, Composition).
  • Intervals (Progress, Markdown and Trace demo intervals never stop #97). Progress, Markdown and Trace key their interval effect on a "still running" flag. The timer clears at the end state and on unmount, and Replay starts a new one. The visible behavior is unchanged.
  • Sidebar account row. The tooltip is type="label", so it names the row. It now reads "shadcn Pro", which matches the visible text. The in-sheet "Close sidebar" label is unchanged.
  • Dropdown Menu shared row menu: unchanged. One createDropdownMenuController<Doc>(), a trigger per row passing payload, and content rendered from the payload. This is ui-sdk's documented detached-trigger pattern (@ui-sdk/react/docs/components/menu.md, "Connect external triggers and one menu to a createMenuController<File>()"). Our docs teach it too, and dropdown-menu.test.tsx pins it.

Verification

  • vpr check passes. vpr test passes: 71 files, 556 passed, 1 expected fail.
  • Progress, Markdown and Trace demo intervals never stop #97 repro. New fake-timer tests demos/{progress,markdown,trace}.test.tsx failed on base with expected 1 to be +0 (the timer still running after the end state; 3 failed, 3 passed). They pass on the fix commit. The failing tests land first, in 126b1ae.
  • InputGroupToggle. input-group.test.tsx checks that aria-pressed flips once per press, type=button, the data-input-group-button attribute, and that the agent snapshot lists exactly one entry, ["toggle"] (a throwaway test of the earlier shape got ["toggle","button"]). demos/button-group.test.tsx covers voice mode (one flip per click, input disabled, one snapshot entry), Favorite, and the https:// label naming the input.
  • Agent bridge snapshot() on the built site, base → after:
    • Voice mode: button press → toggle setPressed (one entry).
    • Favorite: button press → toggle setPressed (one entry).
    • Theming: button Polaris/Vega/Antares → toggle ×3, plus group toggle | Theme | setValue,toggle.
    • Sidebar account row: shadcn → shadcn Pro.
    • Mobile nav: 5 button | press, one entry each.
  • vpr agent-audit, base → after: 84 pages, 81 with unnamed entries, 13 with ambiguous names → the same numbers, and the per-page lines are identical. ambiguousIn flags only same name + same action, so it couldn't see the doubled entry. The new tests pin that case.
  • Screenshots, light and dark, base vs after. They were taken on a static build with Playwright, with popups open and pressed states clicked. The pixel diff is 0 for Button Group (both demos), Dropdown Menu (open), Hover Card (both), Markdown, Progress, Sidebar and the mobile nav. The visual changes, each caused by a real part replacing a fake:
    • Input Group Favorite, pressed: ~430 px. The star now sits on Toggle's pressed fill. Before, it had no fill.
    • Theme builder, light: 1,579 px. The selected preset uses Toggle's pressed fill instead of the secondary Button fill. Dark: 3 px.
    • Scroll Area both axes: tiles instead of the table.
    • Trace, dark: 29 px, run timing.

Tradeoffs

  • InputGroupToggle is a new public part, so the lead should look at it in the batch pass. The other option was ui-sdk's Toggle hand-assembled in the demos, which doubles the agent entry, or a hand-written marker attribute in a snippet. The advisor picked building the part, per AGENTS.md "Dependencies first".
  • The Scroll Area demo no longer shows a table. Table can't sit in a both-axes ScrollArea because it scrolls sideways itself. A tile grid shows the same behavior without faking a component.
  • Button Group text and the mobile nav use ui-sdk's unstyled primitives. Our styled Label/Button would clash with the part that draws, so the primitive supplies the behavior and one part draws, as ARCHITECTURE.md's Composition rule asks.
  • ARCHITECTURE.md isn't updated for the new part (docs after confirm).

Tracker

Row 185 (demos faking parts): done in this PR. Toggle → InputGroupToggle (new part), theme picker → Toggle Group, scroll-area table → tile grid (Table can't nest in a both-axes ScrollArea), native label → ui-sdk Label via ButtonGroupText, mobile nav → ui-sdk Button primitive, shared row menu kept (documented ui-sdk pattern). Also closes #97 (demo intervals) and does the mention half of #52 (hover card sx); #52 also asks for sx={buttonStyles(...)} on the link triggers, kept as spreads per the lead, so #52 stays open for the owner's call, and restores the sidebar account row's name, "shadcn Pro". Follow-up: ARCHITECTURE.md Composition could name InputGroupToggle beside InputGroupButton.

@aayushbtw aayushbtw changed the title fix(site): docs demos use real parts; InputGroupToggle; demo intervals stop (#52, #97) fix(site): docs demos use real parts; InputGroupToggle; demo intervals stop (#97) Nov 21, 2026
@aayushbtw

Copy link
Copy Markdown
Owner Author

Verifier: PASS+NOTES on merge tree 8947239b (ui-sdk 6be0088 + head 7e817b1). check, build, 561 tests. Browser: Toggles press and the agent can setPressed, the Toggle Group theme picker switches themes, Scroll Area scrolls both axes, demo timers stop at the end, the account row is named 'shadcn Pro', 0 console errors. Re-checked registry on the merge with #163 (a6a078e8): check-registry passes. Follow-ups for the docs commit: record the InputGroupToggle choice in ARCHITECTURE.md; the input-group.md Toggle section needs its own preview.

@aayushbtw
aayushbtw merged commit 44adbad into ui-sdk Nov 21, 2026
1 check passed
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.

1 participant