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

Function JsonValue

packages/devtools-ui/src/components/tree.tsx:37–143  ·  view source on GitHub ↗
(props: {
  value: any
  keyName?: string
  isRoot?: boolean
  isLastKey?: boolean
  copyable?: boolean

  defaultExpansionDepth: number
  depth: number

  collapsePaths?: Array<string>
  path: string

  config?: { dateFormat?: string }
})

Source from the content-addressed store, hash-verified

35}
36
37function JsonValue(props: {
38 value: any
39 keyName?: string
40 isRoot?: boolean
41 isLastKey?: boolean
42 copyable?: boolean
43
44 defaultExpansionDepth: number
45 depth: number
46
47 collapsePaths?: Array<string>
48 path: string
49
50 config?: { dateFormat?: string }
51}) {
52 const styles = createStyles()
53
54 return (
55 <span class={styles().tree.valueContainer(props.isRoot ?? false)}>
56 {props.keyName &&
57 typeof props.value !== 'object' &&
58 !Array.isArray(props.value) && (
59 <span class={styles().tree.valueKey}>
60 &quot;{props.keyName}&quot;:{' '}
61 </span>
62 )}
63
64 {(() => {
65 if (typeof props.value === 'string') {
66 return (
67 <span class={styles().tree.valueString}>
68 &quot;{props.value}&quot;
69 </span>
70 )
71 }
72
73 if (typeof props.value === 'number') {
74 return (
75 <span class={styles().tree.valueNumber}>{String(props.value)}</span>
76 )
77 }
78
79 if (typeof props.value === 'boolean') {
80 return (
81 <span class={styles().tree.valueBoolean}>
82 {String(props.value)}
83 </span>
84 )
85 }
86
87 if (props.value === null) {
88 return <span class={styles().tree.valueNull}>null</span>
89 }
90
91 if (props.value === undefined) {
92 return <span class={styles().tree.valueNull}>undefined</span>
93 }
94

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected