Data display
Tree
Nested items such as files or categories. Full keyboard use; the left and right arrows swap in Arabic.
import { Tree, type TreeNode } from "@percentsa/ui";Examples
- Contracts
- NDA.pdf
- 2026
- Invoices
- Brief.docx
Code
export function TreeExample() {
const t = useT();
const file = <FileText />;
const folder = <Folder />;
return (
<Tree
aria-label={t("Files", "الملفات")}
className="w-full max-w-xs"
defaultExpanded={["contracts"]}
items={[
{
id: "contracts",
label: t("Contracts", "العقود"),
icon: folder,
children: [
{ id: "nda", label: "NDA.pdf", icon: file },
{ id: "2026", label: "2026", icon: folder, children: [{ id: "masar", label: "Masar.pdf", icon: file }] },
],
},
{ id: "invoices", label: t("Invoices", "الفواتير"), icon: folder, children: [{ id: "inv", label: "INV-1042.pdf", icon: file }] },
{ id: "brief", label: "Brief.docx", icon: file },
]}
/>
);
}