Tree Link
A tree link is a navigational anchor element representing one link in a tree navigation structure. It renders as a semantic <a> element and is designed to be placed inside a TreeListItem within a TreeList and TreeNav structure.
A tree link is a navigational anchor element representing one link in a tree navigation structure. It renders as a semantic <a> element and is designed to be placed inside a TreeListItem within a TreeList and TreeNav structure.
<a class="tree-link" href="#">Tree link</a><TreeNav label="Documentation sidebar">
<TreeList label="Pages">
<TreeListItem tabindex="0" aria-expanded="true">
<TreeLink href="/docs/components">Components</TreeLink>
<ul role="group">
<TreeListItem tabindex="-1">
<TreeLink href="/docs/components/button">Button</TreeLink>
</TreeListItem>
<TreeListItem tabindex="-1">
<TreeLink href="/docs/components/dialog">Dialog</TreeLink>
</TreeListItem>
</ul>
</TreeListItem>
<TreeListItem tabindex="-1">
<TreeLink href="/docs/api" label="API reference documentation">API Reference</TreeLink>
</TreeListItem>
</TreeList>
</TreeNav>
// In your Svelte component:
import TreeLink from "lily-design-system-svelte-headless/components/TreeLink/TreeLink.svelte";
<TreeLink>TreeLink</TreeLink>
<TreeNav label="Documentation sidebar">
<TreeList label="Pages">
<TreeListItem tabindex="0" aria-expanded="true">
<TreeLink href="/docs/components">Components</TreeLink>
<ul role="group">
<TreeListItem tabindex="-1">
<TreeLink href="/docs/components/button">Button</TreeLink>
</TreeListItem>
<TreeListItem tabindex="-1">
<TreeLink href="/docs/components/dialog">Dialog</TreeLink>
</TreeListItem>
</ul>
</TreeListItem>
<TreeListItem tabindex="-1">
<TreeLink href="/docs/api" label="API reference documentation">API Reference</TreeLink>
</TreeListItem>
</TreeList>
</TreeNav>
href: string (required) -- the URL to navigate tolabel: string (optional, default: undefined) -- accessible label override via aria-labelchildren: slot (required) -- the link text/content...restProps: Any additional HTML attributes spread onto the <a>link role from the <a> elementaria-label -- optional override for descriptive screen reader text, set from the label proplabel prop for descriptive screen reader text when the visible text needs additional context.This component provides a semantic <a> element with optional aria-label override and zero visual styling. The consumer is responsible for all CSS including link color, underline style, hover effects, and focus indicators.
The consumer provides all CSS styling. The component renders with a .tree-link class for targeting. No default styles are included — this is a fully headless component.
<a> element with class tree-linkaria-label is set from the label proplabel prop to provide descriptive screen reader text when the visible text needs additional context.<a> element for tree navigationaria-label override for more descriptive screen reader text...restProps onto the <a> elementTreeLink follows the Nav / List / ListItem composition pattern:
<nav> container providing the navigation landmark.<ol> list with role="tree" providing keyboard navigation.<li> items with role="treeitem".<a> link inside a tree item for navigable nodes.<TreeNav label="Navigation">
<TreeList label="Pages">
<TreeListItem tabindex="0">
<TreeLink href="/home">Home</TreeLink>
</TreeListItem>
<TreeListItem tabindex="-1">
<TreeLink href="/about">About</TreeLink>
</TreeListItem>
</TreeList>
</TreeNav>
tree-nav — a hierarchical navigation with expandable branchestree-list — a hierarchical list with nested expandable itemstree-list-item — one item in a tree navigation listGenerated from this component's canonical metadata — the machine-checked source the implementations are held to.
link role from the <a> elementaria-label -- optional override for descriptive screen reader text, set from the label prophref: string (required) -- the URL to navigate tolabel: string (optional, default: undefined) -- accessible label override via aria-labelchildren: slot (required) -- the link text/content...restProps: Any additional HTML attributes spread onto the <a>