Skip to Content
Liquid Glass UI
Components

Tree

macOS 27 Outline View-style tree with expand / collapse, single selection and cascading checkboxes, plus a TreeSelect that opens a Liquid Glass menu on desktop and an iOS 27 bottom Drawer on mobile.

Two components for hierarchical data that both read plain { id, label | name, children } objects (or anything else via getId / getChildren / renderLabel):

  • Tree: an outline list with expand / collapse (height-animated, honoring prefers-reduced-motion), single selection, and checkboxes with parent / child cascading and an indeterminate state. Rows are 28px / 13px on desktop (macOS 27 Outline View) and 44pt / 16pt on mobile (iOS 27 touch target). Full keyboard support: ↑ ↓ move, ← → collapse / expand (← on a collapsed row jumps to its parent), Home / End, Enter / Space select or check.
  • TreeSelect: picks one node from a tree. The trigger is identical to SelectTrigger (glass capsule, Bordered or Over-Glass). Desktop (>= 768px) opens a 14px Liquid Glass menu whose rows use the macOS Menu Item accent highlight; mobile (< 768px) opens the standard iOS 27 bottom Drawer.
  • Mobile (< 768px · iOS 27): both switch to drill-down navigation, like the Files app or GitHub on a phone — one level per page in Inset Grouped cards; a parent row ends in › and pushes its children in with a slide, and a back button returns. It opens at the level that holds the selected node. In single-select mode every selectable row has a leading radio: the radio picks the node where it is listed (parents included), while tapping a parent row opens it; leaves are picked by tapping anywhere on the row. expandedIds only applies to the desktop outline.

showSelectedCheck={false} highlights the selected row as a whole, like an active Sidebar item. getSelectable keeps folders from being selected — clicking them only toggles them open. renderIcon receives the expanded state, so folders can swap icons:

apple-liquid-ui/preview/tree-liquid-hero
MacBook · 16:10

Installation (Shadcn Registry)

# Install via the @apple-liquid namespace (includes checkbox, popover, select and liquid-glass)
npx shadcn@latest add @apple-liquid/tree

# Or install directly via URL
npx shadcn@latest add https://your-domain.com/r/tree.json

Checkboxes

checkable turns on multi-select. Checking a parent checks every enabled child; a parent becomes checked once all its children are and shows the indeterminate state otherwise. Disabled children keep their state — in that case the next click on the parent unchecks the rest. checkStrictly decouples parents and children. checkedIds only lists fully checked nodes:

apple-liquid-ui/preview/tree-checkable
MacBook · 16:10

TreeSelect

Supports controlled / uncontrolled value, allowClear, size="sm", disabled, and native form submission through name / required (a hidden input). Pass the field label as title for the mobile Drawer header.

multiple switches to checkboxes with the same parent / child cascading as Tree (checkStrictly turns it off); value becomes string[]. The trigger lists only the top-most picks — a fully checked parent stands for its whole subtree — as the first one plus a +N count. The desktop menu stays open while checking; the mobile Drawer gets a Done button, and name submits one hidden input per id:

apple-liquid-ui/preview/tree-select
MacBook · 16:10

Usage

import { Tree, TreeSelect } from '@/components/ui/tree';

const data = [
  {
    id: 'eng',
    name: 'Engineering',
    children: [
      { id: 'web', name: 'Web' },
      { id: 'ios', name: 'iOS' },
    ],
  },
];

export function Example() {
  const [checked, setChecked] = React.useState<string[]>([]);
  const [team, setTeam] = React.useState<string | null>(null);

  return (
    <>
      <Tree data={data} checkable checkedIds={checked} onCheckedChange={setChecked} />
      <TreeSelect
        data={data}
        value={team}
        onValueChange={setTeam}
        placeholder="Choose a team"
        title="Team"
        allowClear
      />
    </>
  );
}

Props API

Tree

PropTypeDefaultDescription
dataT[]—Root nodes
getId / getChildren(node) => string / (node) => T[]node.id / node.childrenRead the id and children of a node
renderLabel(node) => ReactNodenode.label ?? node.nameRow content
renderIcon(node, { expanded }) => ReactNode—Leading icon (accent-tinted by default)
getDisabled / getSelectable(node) => boolean—Disable a row / keep a node from being selected
expandedIds / defaultExpandedIds / onExpandedChangestring[] / string[] | 'all''all'Expansion state (desktop outline; mobile drills down instead)
selectedId / defaultSelectedId / onSelectstring | null / (id, node) => void—Single selection; enabled by passing any of them
showSelectedCheckbooleantrueTrailing checkmark on desktop, leading radio on mobile; false highlights the whole row instead
checkablebooleanfalseTurn on checkboxes
checkedIds / defaultCheckedIds / onCheckedChangestring[][]Fully checked nodes
checkStrictlybooleanfalseParents and children are checked independently
glassbooleanInheritedMaterial of the checkboxes
disableMotionbooleanfalseDisable the expand / collapse animation

TreeSelect

Accepts data, getId, getChildren, getDisabled, getSelectable, renderLabel, renderIcon, defaultExpandedIds and disableMotion like Tree, plus:

PropTypeDefaultDescription
multiplebooleanfalseMulti-select with checkboxes
value / defaultValue / onValueChangestring | null (string[] with multiple)null / []Selected node id(s); null / [] when cleared
checkStrictlybooleanfalseWith multiple: no parent / child cascading
placeholderReactNode'Select'Trigger text while nothing is selected
titleReactNode'Select'Mobile Drawer header
emptyTextReactNode'No options'Shown when data is empty
allowClearbooleanfalseClear button on the trigger
size'default' | 'sm''default'Same steps as SelectTrigger
glassbooleantrueGlass trigger and menu; false renders both 100% opaque
name / required / disabled——Form integration (hidden input)
contentClassNamestring—Classes for the desktop menu / mobile Drawer

Language & Text

Tree, TreeSelect accept locale and messages, which apply to all of its parts and the overlays it opens and win over the global <LiquidGlassProvider locale messages>. To override the text globally, put it under messages.tree on the provider. See Liquid Glass → Global settings.

PropTypeDescription
localeLiquidGlassLocaleInputUI language of this component (any BCP 47 tag; unsupported ones fall back to English)
messagesPartial<TreeMessages>Text overrides, merged over the built-in text and the global messages.tree
KeyBuilt-in text (English)
titleSelect
emptyNo options
clearClear
backBack
doneDone

On this page