MCPcopy Create free account
hub / github.com/TanStack/devtools / Expander

Function Expander

packages/devtools-ui/src/components/tree.tsx:410–444  ·  view source on GitHub ↗
(props: { expanded: boolean; onClick: () => void })

Source from the content-addressed store, hash-verified

408
409 return (
410 <button
411 data-tsd-control
412 data-copy-state={copyState()}
413 class={styles().tree.actionButton}
414 title="Copy object to clipboard"
415 aria-label={`${
416 copyState() === 'NoCopy'
417 ? 'Copy object to clipboard'
418 : copyState() === 'SuccessCopy'
419 ? 'Object copied to clipboard'
420 : 'Error copying object to clipboard'
421 }`}
422 onClick={
423 copyState() === 'NoCopy'
424 ? () => {
425 navigator.clipboard
426 .writeText(JSON.stringify(props.value, null, 2))
427 .then(
428 () => {
429 setCopyState('SuccessCopy')
430 setTimeout(() => {
431 setCopyState('NoCopy')
432 }, 1500)
433 },
434 (err) => {
435 console.error('Failed to copy: ', err)
436 setCopyState('ErrorCopy')
437 setTimeout(() => {
438 setCopyState('NoCopy')
439 }, 1500)
440 },
441 )
442 }
443 : undefined
444 }
445 >
446 <Switch>
447 <Match when={copyState() === 'NoCopy'}>

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected