HextaUI

Tree (UI SDK): Disabled

A disabled item can still take focus, so screen readers find it, but it can’t be selected, checked or opened.

Workspace
General
Billing
Members
Danger zone
import { Tree, type TreeItemData } from "@/components/ui/ui-sdk-tree"

const items: TreeItemData[] = [
  {
    value: "workspace",
    label: "Workspace",
    children: [
      { value: "general", label: "General" },
      { value: "billing", label: "Billing", disabled: true },
      { value: "members", label: "Members" },
    ],
  },
  { value: "danger", label: "Danger zone", disabled: true },
]

function UiSdkTreeDisabled() {
  return (
    <Tree
      aria-label="Settings"
      items={items}
      defaultExpanded={["workspace"]}
      defaultValue="general"
      className="max-w-xs"
    />
  )
}

export { UiSdkTreeDisabled }

This adds the example as components/examples/ui-sdk-tree/disabled.tsx, together with the Tree component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-tree-disabled.json

To add only the component, follow the Tree installation.

Props in this example

The Tree props this example sets, from the API reference.

PropTypeDefault
itemsThe whole hierarchy. Without children, the tree renders styled rows from it.
TreeItemData[]–
defaultValue
string | string[] | null–
defaultExpanded
string[]–

Every prop is in the Tree API reference.

See them all, with keyboard support and accessibility notes, on the Tree page.