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

Function CopyButton

packages/devtools-ui/src/components/tree.tsx:356–408  ·  view source on GitHub ↗
(props: { value: unknown })

Source from the content-addressed store, hash-verified

354 {`...`}
355 </span>
356 </Show>
357
358 <span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
359 {'}'}
360 </span>
361 </span>
362 }
363 >
364 <Match when={props.value instanceof Date}>
365 <span class={styles().tree.expanderContainer}>
366 {props.keyName && (
367 <span
368 data-tsd-syntax="property"
369 class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
370 >
371 &quot;{props.keyName}&quot;:{' '}
372 </span>
373 )}
374
375 <span data-tsd-syntax="string" class={styles().tree.valueBraces}>
376 {dayjs(props.value as unknown as Date).format(
377 props.config?.dateFormat ? props.config.dateFormat : 'DDMMMYY',
378 )}
379 </span>
380 </span>
381 </Match>
382 <Match when={keys().length === 0}>
383 <span class={styles().tree.expanderContainer}>
384 {props.keyName && (
385 <span
386 data-tsd-syntax="property"
387 class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
388 >
389 &quot;{props.keyName}&quot;:{' '}
390 </span>
391 )}
392
393 <span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
394 {'{}'}
395 </span>
396 </span>
397 </Match>
398 </Switch>
399 )
400}
401
402type CopyState = 'NoCopy' | 'SuccessCopy' | 'ErrorCopy'
403
404const CopyButton = (props: { value: unknown }) => {
405 const styles = createStyles()
406 const { theme } = createTheme()
407 const [copyState, setCopyState] = createSignal<CopyState>('NoCopy')
408
409 return (
410 <button
411 data-tsd-control

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected