TreeviewNode

Data Display
stable

Single node in a Treeview — renders chevron, icon, label and size badge; recursively renders children when expanded. Handles its own expand/select keyboard interactions.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamTreeviewNodeSchematic of the TreeviewNode component with 8 numbered internal parts. › 📁 node.label size #node slot origam-treeview-node (recursive children) 1 2 3 4 5 6 7 8 origam-treeview-node ③ guide lines · ④ chevron · ⑤ icon · ⑥ label · ⑦ size — inside ② row; ⑧ = recursive children
Anatomy of <origam-treeview-node> — 8 parts. The root wrapper holds the interactive row (with guide lines, chevron, icon, label and size) followed by the optional node slot and the recursive children group.
1.origam-treeview-node
Root wrapper, role="none". Flex column, no ARIA role — ARIA is on the inner row.
2.origam-treeview-node__row
Interactive row. role="treeitem", aria-expanded, aria-selected, aria-disabled, tabindex. Handles click and keyboard events.
3.origam-treeview-node__guide
Vertical guide line repeated once per depth level (depth > 0 and showLines=true). aria-hidden="true".
4.origam-treeview-node__chevron
Expand/collapse indicator. Rotates 90° when expanded. Invisible (visibility: hidden) on leaf nodes.
5.origam-treeview-node__icon
Node icon — custom node.icon, or a folder emoji (expanded/collapsed), or a document emoji for leaves. aria-hidden="true".
6.origam-treeview-node__label
Node label text. flex: 1, truncated with ellipsis. Uses the node.label value.
7.origam-treeview-node__size
Optional size badge. Only rendered when node.size is provided.
8.origam-treeview-node__children
Children container, role="group", aria-label="{node.label} contents". Shown only when expanded. Recursively renders <OrigamTreeviewNode> for each child.

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

node
requis
ITreeviewNode
—
The node data object. Shape: { id, label, icon?, size?, children?, disabled?, expandable? }.
depth
number
0
Nesting depth level used to compute the inline-start indent via CSS calc. Automatically incremented for child nodes.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue

API

Slots

Emplacements de contenu exposés par ce composant.

#node
Custom render slot injected after the row. Receives the current node data, depth, expanded and selected states. Forwarded recursively to all child OrigamTreeviewNode instances.

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to a child component.
ComputedRef<boolean>
Reactive ref: true when this node is currently expanded.
ComputedRef<boolean>
Reactive ref: true when this node is currently selected.
Ref<string>
Reactive CSS string generated by useStyle.
string
Unique style-sheet ID for this instance.
() => void
Injects the computed style sheet into the document.
() => void
Removes the injected style sheet.
Ref<boolean>
True once the style sheet has been injected into the DOM.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

Indent per depth level. Applied via CSS calc on the row padding-inline-start.
Minimum row height.
Horizontal padding added to the base indent on the row.
Row background on hover.
Row background when selected.
Label color when selected.
Label color when disabled.
Width and height of the chevron element.
Color of the chevron glyph.
Color of the vertical guide lines.
Thickness of the vertical guide lines.
Font size of the node label.
Font size of the node icon.

Inclusion

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

treeitem

Interactions clavier

Interactions clavier
ToucheAction
Enter / SpaceSelects the node (if selectable) or toggles expansion (if it has children and is not selectable).
ArrowRightIf collapsed and has children: expands. If expanded and has children: moves focus to first child.
ArrowLeftIf expanded: collapses the node. If collapsed: moves focus to the parent treeitem.
TabMoves focus out of the tree to the next focusable element in the page.

Notes

  • OrigamTreeviewNode uses a wrapper with role="none" and an inner interactive div with role="treeitem". ARIA attributes (aria-expanded, aria-selected, aria-disabled, aria-label) are applied to the inner row only.
  • The children container uses role="group" with aria-label="{node.label} contents" as required by the ARIA tree pattern.
  • Focus-visible outline is applied on the row via :focus-visible (2px solid, outline-offset: -2px).
  • Guide lines, chevron and icon are all aria-hidden="true". Only the label contributes to the accessible name (supplemented by aria-label="node.label" on the treeitem).

Fondation

Design tokens

Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.

Source
dimension
var(--origam-space---4)
Indent per depth level.
dimension
var(--origam-space---8)
Minimum row height.
color
var(--origam-color__surface---overlay)
Row background on hover.
color
var(--origam-color__action--primary---bgSubtle)
Row background when selected.
dimension
var(--origam-font__size---sm)
Font size of the node label.
color
var(--origam-color__border---subtle)
Color of the vertical guide lines.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Standalone node (inside a treeview)

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.