JSON viewer preview
Inspect valid JSON as a searchable keyboard tree or exact read-only source with paths and consumer-owned copy actions.
pro · Data · composite
When to use
- Use it when a page needs inspect valid json as a searchable keyboard tree or exact read-only source with paths and consumer-owned copy actions.
- Choose it when the data structure, labels, and state are supplied by the application and must remain consumer controlled.
Alternatives
- Choose data-table instead when sortable column controls, native row selection and a scrollable table is the actual interface need, rather than json viewer.
Configure components.json and the @tidal-pro namespace before installing Pro components.
Installation
npx shadcn@latest add @tidal-pro/json-viewerImport components/ui/tidal.css, components/ui/json-viewer.css. Wrap installed components in tidal-scope.
Preview

Minimal example
import"./components/ui/tidal.css";
import"./components/ui/json-viewer.css";
import{TidalJsonViewer}from"./components/ui/json-viewer";
export default()=><div className="tidal-scope"><TidalJsonViewer expandedPaths={["value"]} label={"Demo"} onExpandedPathsChange={() => {}} onSelectedPathChange={() => {}} onViewChange={() => {}} selectedPath={"value"} value={"value"} view={"source"}/></div>;API and props
TidalJsonViewer.expandedPaths (required)ReadonlyArray<string>Required expanded paths value accepted by this exported component.
TidalJsonViewer.label (required)stringRequired label value accepted by this exported component.
TidalJsonViewer.onExpandedPathsChange (required)(paths: readonly string[], path: string, value: TidalJsonValue, event: TidalTreeInteractionEvent | MouseEvent<HTMLButtonElement>) => voidCallback invoked when the expanded paths change interaction is proposed.
TidalJsonViewer.onSelectedPathChange (required)(path: string, value: TidalJsonValue, event: TidalTreeInteractionEvent) => voidCallback invoked when the selected path change interaction is proposed.
TidalJsonViewer.onViewChange (required)(view: TidalJsonView, event: MouseEvent<HTMLButtonElement>) => voidCallback invoked when the view change interaction is proposed.
TidalJsonViewer.selectedPath (required)string | nullRequired selected path value accepted by this exported component.
TidalJsonViewer.value (required)TidalJsonValueRequired value value accepted by this exported component.
TidalJsonViewer.view (required)TidalJsonViewRequired view value accepted by this exported component.
TidalJsonViewer.copyButtonPropsNativeButtonProps | undefinedOptional copy button props value accepted by this exported component.
TidalJsonViewer.copyButtonRefRef<HTMLButtonElement> | undefinedOptional copy button ref value accepted by this exported component.
TidalJsonViewer.descriptionReactNodeOptional description value accepted by this exported component.
TidalJsonViewer.dir"ltr" | "rtl" | undefinedOptional dir value accepted by this exported component.
TidalJsonViewer.disabledboolean | undefinedOptional disabled value accepted by this exported component.
TidalJsonViewer.headingLevelTidalJsonHeadingLevel | undefinedOptional heading level value accepted by this exported component.
TidalJsonViewer.labelsPartial<TidalJsonViewerLabels> | undefinedOptional labels value accepted by this exported component.
TidalJsonViewer.maxStringLengthnumber | undefinedOptional max string length value accepted by this exported component.
TidalJsonViewer.onCopyRequest((request: TidalJsonCopyRequest, event: MouseEvent<HTMLButtonElement>) => void) | undefinedCallback invoked when the copy request interaction is proposed.
TidalJsonViewer.onQueryChange((query: string, event: ChangeEvent<HTMLInputElement>) => void) | undefinedCallback invoked when the query change interaction is proposed.
TidalJsonViewer.querystring | undefinedOptional query value accepted by this exported component.
TidalJsonViewer.searchInputPropsSearchInputProps | undefinedOptional search input props value accepted by this exported component.
TidalJsonViewer.searchInputRefRef<HTMLInputElement> | undefinedOptional search input ref value accepted by this exported component.
TidalJsonViewer.sourceButtonPropsNativeButtonProps | undefinedOptional source button props value accepted by this exported component.
TidalJsonViewer.sourceButtonRefRef<HTMLButtonElement> | undefinedOptional source button ref value accepted by this exported component.
TidalJsonViewer.sourceMaxHeightnumber | undefinedOptional source max height value accepted by this exported component.
TidalJsonViewer.treeButtonPropsNativeButtonProps | undefinedOptional tree button props value accepted by this exported component.
TidalJsonViewer.treeButtonRefRef<HTMLButtonElement> | undefinedOptional tree button ref value accepted by this exported component.
TidalJsonViewer.treeRefRef<HTMLDivElement> | undefinedOptional tree ref value accepted by this exported component.
Complete usage
Full example, stylesheet imports, API and accessibility documentation
Gotchas
- Supply truthful data and labels; the component does not fetch, aggregate, or persist records.