JsonField

Renders a JSON value as indented text in a <pre>, for objects, arrays and JSON strings.

Installation

pnpm dlx shadcn@latest add @chelone/json-field

Renders a JSON value as indented text in a <pre>, for objects, arrays and JSON strings.

Props

PropTypeDefaultDescription
cellClassNamestring—A class name to apply to the cell element when used inside `<DataTable>`.
classNamestring—A class name to apply to the root element.
emptyReactNode—Shown in a span when the value is null or undefined. A string is translated.
headerClassNamestring—A class name to apply to the header cell element when used inside `<DataTable>`.
indentnumber—Spaces per indentation level. Defaults to 2.
labelReactNode—Label to use as column header when using `<DataTable>` or `<SimpleShowLayout>`. Defaults to the capitalized field name. Set to `false` to disable the label.
recordRecordType—The record to render. Defaults to the ambient `RecordContext` value.
resourcestring—The resource name. Defaults to the ambient `ResourceContext` value.
sortableboolean—Disable the header click handler when used inside `<DataTable>`.
sortBystring—The field to sort by when this column head is clicked, if sortable.
sortByOrderSortOrder—The order used for sorting when this column head is clicked, if sortable.
sourcestring—Name of the property to display (dot/bracket path).
textAlignTextAlign—The text alignment for the cell content, when used inside `<DataTable>`.