Skip to content

Feedback from building a shadcn-style component library on GPUIX (Select item discovery, missing type exports, primitives) #59

Closed

Description

@drewnekota

Hi! I built a shadcn-style component library on top of GPUIX: https://github.com/drewnekota/gpuix-ui (headless Dialog / Popover / DropdownMenu / Tabs / Checkbox / Switch / RadioGroup / Collapsible primitives, styled components, theme tokens, and an agent-chat example, all tested through createTestRoot). Your AGENTS.md asks outside contributors to open issues rather than PRs, so here are the things I hit that seem to belong upstream. Happy to turn any of them into a PR if you want one.

1. Select / Combobox find items by component identity

collectItems in select.js matches child.type === SelectItem. Any wrapper component around SelectItem (the whole point of the "wrap it in components/ui/select.tsx" pattern the README recommends) is invisible to it: items ends up empty, so SelectValue shows nothing and Up/Down/Enter do nothing, while the content still paints. I worked around it by having my styled Select rewrite <SelectItem> elements into primitive items before passing children down (see packages/ui/src/select.tsx).

Suggestion: let items register themselves through context on mount (the Radix approach) instead of walking the element tree, or expose a static marker (SelectItem.__gpuixItem = true) wrappers can copy. Combobox has the same shape.

2. Props and GpuixTheme types are not exported

StyleDesc, PublicInstance, EventPayload are exported from @gpuix/react, but Props (the div prop type) and GpuixTheme are not. A component library needs both constantly. I derive them from JSX.IntrinsicElements['div'] and NonNullable<JSX.IntrinsicElements['markdown']['theme']> via @gpuix/react/jsx-runtime, which works but is fragile.

3. Headless primitives that would fit next to Select / Combobox / Tooltip

Dialog, Popover, DropdownMenu, Tabs, Checkbox, Switch, RadioGroup, Collapsible. Mine live in packages/primitives/src/*.tsx and only use public API: <anchored deferred> with position: {x:0,y:0} for the modal layer (which turns out to be window-absolute, so no portal is needed), onMouseDownOutside for dismissal, tabIndex + autoFocus + renderer.focusElement for focus management, and a small mount-order registry for arrow-key navigation. Two things I could not do from userland and would love primitives for:

  • Focus trap / Tab containment inside a dialog. Tab from the last focusable element in the panel walks out to the page behind the overlay. focusNext/focusPrevious exist but there is no way to scope traversal to a subtree.
  • Measuring an element from JS (getElementBounds is test-only). Typeahead, align="center" on menus wider than the trigger, and "scroll the highlighted item into view" all want it.

4. Small things

  • A filled child div blocks the click on its parent (documented), which means every switch thumb / radio dot needs pointerEvents: 'none'. A pointerEvents: 'none' default for children of an element that has onClick and no handlers of their own might be friendlier, though I understand if that is too magic.
  • floating.js (FloatingLayer, renderSlot, useControllableState, StateStyle) is not in the exports map, so a library has to copy it to build new floating primitives. Exporting it as @gpuix/react/floating would let third-party primitives share the same anchoring behaviour.

Thanks for GPUIX, it was a pleasure to build on. The whole thing, including the chat example with menus and dialogs, came together in a day on 0.7.0.

Activity

  1. added a commit that references this issue on Sep 10, 2026
    846de94
  2. added a commit that references this issue on Sep 14, 2026
    89b6799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions