ClayClay
  • Get Started
    • How to Use Clay
    • Composition Philosophy
    • How to Read This Documentation
    • Migrating From v2.x
    • Using Clay in JSPs
  • Components
    • Alert
    • Application Bar
    • Aspect Ratio
    • Autocomplete
    • Badge
    • Breadcrumb
    • Button Group
    • Buttons
    • Card
    • Chart
    • Color Picker
    • Data Provider
    • Date Picker
    • Drop Down
    • Empty State
    • Form
      • Checkbox
      • Dual List Box
      • Input
      • Radio Group
      • Select
      • Select Box
      • Toggle Switch
    • Forms Hierarchy
    • Heading
    • Icon
    • Label
    • Layout
    • Link
    • List
    • Loading Indicator
    • Localized Input
    • Management Toolbar
    • Menubar (Vertical Navigation)
    • Modal
    • Multi Select
    • Multi Step Nav
    • Nav
    • Navigation Bar
    • OverlayMask
    • Pagination
    • Pagination Bar
    • Panel
    • Popover
    • Progress Bar
    • Provider
    • Sidebar
    • Slider
    • Sticker
    • Table
    • Tabs
    • Text
    • Timelines
    • Time Picker
    • Toolbar
    • Tooltip
    • TreeView
    • Upper Toolbar
    • VerticalBar
  • Contributing
  • CSS Framework
    • Paver
    • SCSS
    • Color
    • Grid
    • Content
      • Typography
      • C Kbd
    • Utilities
      • Accessibility
      • Autofit
      • Border
      • C Focus Inset
      • C Inner
      • Color Utilities
      • C Spacing Utilities
      • Display
      • Flex
      • Float
      • Inline Item
      • Overflow
      • Position
      • Shadow
      • Text
      • Vertical Align
      • Visibility
      • Width and Height
    • Playground
  • Examples
  • Docs
  • Sass API
  • Blog
  • Storybook
  • Codesandbox
  • Github
  • Use this menu to toggle between Atlas and Base Themes.

TreeView

yarn add @clayui/core

A tree view is a component based on nodes that are shown in a hierarchical structure.

  • Examples
  • Markup
  • API

Beta3.68.0View in LexiconCHANGELOGstorybook demos

TreeView

PropertyTypeRequiredDefaultDescription
displayType
'light' | 'dark'false'light'Flag to determine which style the TreeView will display.
dragAndDrop
booleanfalsefalseFlag to enable Drag and Drop of Nodes over the Tree.
dragAndDropContext
Window & typeof globalThisfalsewindowOptional drag and drop context: this is to avoid errors when using various drag and drop contexts on the same page.
expandDoubleClick
booleanfalsefalseFlag to expand the node's children when double-clicking the node.
expandOnCheck
booleanfalsefalseFlag to expand child nodes when a parent node is checked.
expanderClassName
stringfalseExtra classes passed to the expander button.
expanderIcons
IconsfalseFlag to modify Node expansion state icons.
onItemMove
(item: T, parentItem: T) => voidfalseCallback is called when an item is about to be moved elsewhere in the tree.
onLoadMore
(item: T) => Promise<unknown>falseWhen a tree is very large, loading items (nodes) asynchronously is preferred to decrease the initial payload and memory space. The callback is called every time the item is a leaf node of the tree.
onSelect
(item: T) => voidfalseCallback called whenever an item is selected. Similar to the `onSelectionChange` callback but instead of passing the selected keys it is called with the current item being selected.
onRenameItem
(item: T) => Promise<T>falseCalback is called when the user presses the R or F2 hotkey.
selectionMode
'single' | 'multiple' | 'multiple-recursive' | nullfalse'single'Flag changes the Node selection behavior when a checkbox is rendered on the Node. - single: select only node. - multiple: select multiple nodes. - multiple-recursive: selects multiple nodes and recursively.
showExpanderOnHover
booleanfalsetrueFlag to indicate if the TreeView will show the expander in the hover in the Node.
nestedKey
false'children'
selectionHydrationMode
false'hydrate-first'

TreeView.Item

PropertyTypeRequiredDefaultDescription
active
booleanfalseFlag to set the node to the active state.
actions
React.ReactElementfalseProperty for rendering actions on a Node.
children
React.ReactNodetrueItem content.
disabled
booleanfalseFlag indicating that the component is disabled.
noHover
booleanfalseFlag to remove the visual of the hover over the item.

TreeView.ItemStack

PropertyTypeRequiredDefaultDescription
active
booleanfalseFlag to set the node to the active state.
children
React.ReactNodetrueItem content.
disabled
booleanfalseFlag indicating that the component is disabled.
expanderDisabled
booleanfalseFlag indicating if Expander is disabled, by default it has the value of the disabled prop.
noHover
booleanfalseFlag to remove the visual of the hover over the item.

TreeView.Group

PropertyTypeRequiredDefaultDescription
children
React.ReactNode | (item: T) => React.ReactElementtrueGroup content.
items
Array<T>falseProperty to inform the dynamic data of the tree.

How can this be improved? Create an issue!