Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A collapsible JSON tree view for Angular

License

NotificationsYou must be signed in to change notification settings

MichaelDoyle/ngx-json-treeview

Repository files navigation

A simple Angular component to display object data in an expandable JSON tree view.

image

Key Features

  • Display JSON objects and arrays in a collapsible tree structure.
  • Customize styling with CSS variables.
  • Clickable value nodes for custom interactions.
  • Control over initial expansion depth.
  • Keyboard navigable

Demo

https://stackblitz.com/edit/ngx-json-treeview

Install

npm install ngx-json-treeview

Usage

To render JSON in its fully expanded state.

<ngx-json-treeview[json]="someObject"/>

To render JSON with all nodes collapsed.

<ngx-json-treeview[json]="someObject"[expanded]="false"/>

Alternatively, expand only to a max depth by default.

<ngx-json-treeview[json]="someObject"[depth]="1"/>

You can enable the user to click on values. ProvideonValueClick to implementthe desired behavior.

<ngx-json-treeview[json]="someObject"[enableClickableValues]="true"(onValueClick)="onValueClick($event)"/>

Theming

You can customize the appearance of the tree view using these CSS variables:

VariableDescription
--ngx-json-font-familyFont family for the tree view.
--ngx-json-font-sizeFont size for the tree view.
--ngx-json-focus-colorOutline color for focused elements.
--ngx-json-togglerColor of the expand/collapse toggler.
--ngx-json-keyColor of object keys.
--ngx-json-labelColor of array indices.
--ngx-json-valueDefault color for primitive values.
--ngx-json-stringColor for string values.
--ngx-json-numberColor for number values.
--ngx-json-booleanColor for boolean values.
--ngx-json-dateColor for date values.
--ngx-json-functionColor for function values.
--ngx-json-nullText color for null values.
--ngx-json-null-bgBackground color for null values.
--ngx-json-undefinedText color for undefined values.
--ngx-json-undefined-keyKey color for undefined values.
--ngx-json-undefined-bgBackground color for undefined values.
--ngx-json-punctuationColor of braces, brackets, and commas.

Thanks

ngx-json-treeview is originally based onngx-json-viewer by Vivo Xu and contributors.

About

A collapsible JSON tree view for Angular

Topics

Resources

License

Stars

Watchers

Forks

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp