Skip to content

JsonField

JsonField(props): Element

Defined in: packages/ui/src/fields/json-field.tsx:21

Read-only display component that renders a JSON value as formatted code.

When collapsed is true, shows a single-line preview (truncated at 60 chars) with an “expand” button. When expanded, displays the full pretty-printed JSON in a <pre> block. Returns an em-dash for null/undefined values.

JsonFieldProps

See JsonFieldProps.

Element

A <pre> with formatted JSON, a collapsed preview, or a placeholder <span> for null values.

<JsonField value={{ tags: ["react", "typescript"] }} collapsed />
// -> '{"tags":["react","typescript"]}' with expand button