Tree
A hierarchy, such as pages or files, whose branches open and close, moved through with the arrow keys.
npx shadcn add https://kinoui.com/r/tree.jsonCopy install command
Examples
Default
Press a folder to open it, or a page to pick it. Arrows, Home, End and typing a name move through what shows.
Multiple
With multiple, a press or Space adds a page or takes it away, while a press on a folder only opens it; Ctrl or ⌘ with a press picks the folder. Shift with a press or Space picks the items in between.
- Product
- Research
- Design
- Legal
- Team handbook
Controlled
Hold expanded yourself to open branches from elsewhere, as Expand all does.
Installation
Copy code
npx shadcn@latest add https://kinoui.com/r/tree.json- Files
lib/reduce-motion.tslib/resize.tscomponents/kino/collapsible.tsxlib/controllable.tslib/run-progress.tslib/highlight.tslib/scroll.tscomponents/kino/separator.tsxlib/popup.tslib/menu.tsxlib/pick.tslib/refs.tscomponents/kino/tree.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
Tree
TreeItem
Data attributes
Accessibility
- It follows the WAI-ARIA tree pattern (opens in a new tab): the list is a
tree, each item atreeitemwith its level, and a branch’s items agroup. Tab lands on one item: the picked one, else the first. - Up and Down move through what shows. Right opens a branch, then moves into it; Left closes it, then moves to its parent. In right to left, the two swap. Home and End go to the first and last item,
*opens every branch beside this one, and typing a name moves to the next item that starts with it. - Enter picks the item and opens or closes a branch; Space picks it. With
multiple, the tree isaria-multiselectable: Enter only opens or closes a branch, Space adds or takes an item away, Shift with Up or Down carries the pick along, and Ctrl+A or ⌘A picks every item that shows. - A branch that closes with focus inside it takes the focus. A disabled item is
aria-disabledand still takes focus, so it can be read. - Picked rows take the system’s highlight colours under forced colours, and the focus ring keeps an outline there.
- When the system asks for less motion, branches open and close at once, the chevron jumps to its place, and the highlight only fades.