FileTree displays nested files and folders. Use the arrow keys to move through visible rows, expand or collapse folders, and select an item.
Each item has a unique id, a display name, and a discriminating type. Files may provide an optional icon; folders contain a recursive children array.
Use selectedId with onSelectedIdChange to control selection (onSelect fires on every choice, also of the selected item), and expandedIds with onExpandedIdsChange to control open folders. Omit those state props to let the component manage the state internally; use defaultSelectedId and defaultExpandedIds for initial state.
onItemClick reports pointer clicks. renderItem replaces the row label and receives the item plus its selected, expanded, and depth state. emptyState and loadingState customize the corresponding placeholders; set loading to show the loading state.
- Up and Down move between visible rows; Home and End move to the first and last row.
- Right opens a closed folder or focuses its first child.
- Left closes an open folder or focuses its parent.
- Enter and Space select the focused item.
The component uses the ARIA tree pattern and exposes selection and expansion state to assistive technology.