ef-hierarchy

Layer panel. Displays the element tree of the target composition.

Shows all temporal elements in the target composition as a collapsible, selectable tree. Fires hierarchy-select when an element is clicked and hierarchy-reorder when elements are dragged to a new position.

<ef-hierarchy target="root" show-header header="Layers"
  style="display: block; width: 240px;"></ef-hierarchy>

Each row is rendered by an internal ef-hierarchy-item:

ef-hierarchy-item::part(row):hover { background: rgba(255, 255, 255, 0.05); }
ef-hierarchy-item::part(label)     { font-size: 0.75rem; }

Attributes

AttributeReact propTypeDefaultDescription
headerheaderstring""Header text shown above the tree (when `show-header`).
show-headershowHeaderbooleanfalseWhether to show the header row.
targettargetstring""ID of the target element this component controls or reads from.

CSS Parts

PartDescription
headerThe optional header above the tree items. This part appears when the `show-header` attribute is set.
listThe outer container that holds the hierarchy tree.

CSS Custom Properties

PropertyDefaultDescription
--hierarchy-bgvar(--ef-color-bg)Background color of the tree container.
--hierarchy-bordervar(--ef-color-border)Border color (header divider).
--hierarchy-drop-indicatorvar(--ef-color-primary)Color of the drag-and-drop reorder indicator line.
--hierarchy-hover-bgvar(--ef-color-border-subtle)Row background color on hover.
--hierarchy-selected-bgvar(--ef-color-primary-subtle, rgba(110,168,254,0.18))Row background color when selected.
--hierarchy-textvar(--ef-color-text)Text color.

Events

EventDetailDescription
hierarchy-highlight{ element: Element | null }Fires when the highlighted element changes, for example when the user hovers over it in `ef-canvas`. This event fires through {@link EFHierarchyElement#setHighlighted}.
hierarchy-reorder{ sourceId: string; targetId: string; position: "before" | "after" | "inside" }Fires when the user drags a row to a new position.
hierarchy-select{ elementId: string | null }Fires when the user clicks an element row, or when a script calls {@link EFHierarchyElement#select} directly.

Methods

MethodDescription
select(elementId: string | null): voidSelect an element by its ID. Pass `null` instead to clear the selection.
getSelectedElementId(): string | nullReturns the ID of the first selected element. Returns `null` if nothing is selected.
getHighlightedElement(): Element | nullReturns the element currently highlighted through {@link setHighlighted}. Returns `null` if no element is highlighted.
setHighlighted(el: Element | null): voidSets the element that is highlighted from outside this element. For example, code can call this when the user hovers over the element in `ef-canvas`. This method also dispatches the `hierarchy-highlight` event.