Skip to content

Conversation

@akshat-OwO
Copy link
Contributor

🎯 Changes

Custom Trigger Component Support

  • Added an optional triggerComponent property to the devtools configuration, allowing users to specify a custom function or React element to render the devtools trigger. This replaces the default trigger button if provided. (packages/devtools/src/context/devtools-store.ts, packages/react-devtools/src/devtools.tsx)
  • Updated the trigger rendering logic in Trigger to check for a custom trigger component and render it via a container reference if present. (packages/devtools/src/components/trigger.tsx)

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

- changes in config to accept an optional custom trigger component
- replaces default trigger and allows for rendering a custom trigger
@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2025

🦋 Changeset detected

Latest commit: 1cc9a12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@tanstack/react-devtools Minor
@tanstack/devtools Minor
@tanstack/solid-devtools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@maastrich
Copy link

Not blocking this pr but this partially answers to the problem of custom trigger, we cannot control where it will end up, I would have prefer something like a hook or an event emitter to open/close the devtools pannel so I can put it anywhere I want (in my case I want it not floating within a sidebar menu)

Both are not incompatible

Comment on lines 45 to 59
<Show
when={settings().triggerComponent}
fallback={
<button
type="button"
aria-label="Open TanStack Devtools"
class={buttonStyle()}
onClick={() => setIsOpen(!isOpen())}
>
<img src={image || TanStackLogo} alt="TanStack Devtools" />
</button>
}
>
<img src={image || TanStackLogo} alt="TanStack Devtools" />
</button>
<div ref={setContainerRef} />
</Show>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would do this a bit differently, I would still use the button, and have this div inside of it conditionally rendered with a show, that way you don't have to implement the positions etc yourself, you would only provide the theme to the button and that's it, the rest is handled by the devtools

@AlemTuzlak
Copy link
Collaborator

@maastrich That would be a whole different feature IMO, so you want to be able to open/close devtools somewhere in your code without using the trigger from the devtools?

@nx-cloud
Copy link

nx-cloud bot commented Oct 30, 2025

View your CI Pipeline Execution ↗ for commit 1cc9a12

Command Status Duration Result
nx affected --targets=test:format,test:eslint,t... ✅ Succeeded 48s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 8s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-30 12:40:08 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 30, 2025

More templates

@tanstack/devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools@228

@tanstack/devtools-client

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-client@228

@tanstack/devtools-ui

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-ui@228

@tanstack/devtools-utils

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-utils@228

@tanstack/devtools-vite

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-vite@228

@tanstack/devtools-event-bus

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-event-bus@228

@tanstack/devtools-event-client

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/devtools-event-client@228

@tanstack/react-devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/react-devtools@228

@tanstack/solid-devtools

npm i https://pkg.pr.new/TanStack/devtools/@tanstack/solid-devtools@228

commit: 1cc9a12

@AlemTuzlak AlemTuzlak merged commit d524864 into TanStack:main Oct 30, 2025
5 checks passed
@github-actions github-actions bot mentioned this pull request Oct 30, 2025
@kyjus25 kyjus25 mentioned this pull request Oct 30, 2025
2 tasks
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.

3 participants