j3w1 / theme

j3w1 / theme4.0.0

j3w1 / command

  • SPEC Overview
  • SPEC Foundations
  • SPEC Components
  • SPEC Patterns
  • SPEC Tokens
  • SPEC Tools
  • SPEC Workbench
  • SPEC Form builder
  • SPEC Task kit
  • SPEC Recipes
  • SPEC Figma bridge
  • SPEC Report an issue
  • SPEC Implement
  • SPEC For agents
  • SPEC Ports
  • SPEC Releases
  • SPEC Specification
  • DEMO Vue application demo

Tree

Hierarchical navigation with explicit expansion and one roving tab stop.

stable · light DOM · 4.0.0. Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.

Live variants

default

  • Source
    • App.vue
    • styles.css
  • README.md
Markup
<j3w1-tree id="example-tree-default"><ul class="tree" role="tree" aria-label="Workspace files"><li role="treeitem" id="example-tree-default-tree-source" aria-expanded="true" tabindex="0" data-demo-focus-target=""><span data-tree-label="">Source<button type="button" tabindex="-1" data-tree-toggle="" aria-label="Toggle children">▸</button></span><ul role="group"><li role="treeitem" id="example-tree-default-tree-app" tabindex="-1" aria-selected="true"><span data-tree-label="">App.vue</span></li><li role="treeitem" id="example-tree-default-tree-styles" tabindex="-1" aria-selected="false"><span data-tree-label="">styles.css</span></li></ul></li><li role="treeitem" id="example-tree-default-tree-readme" tabindex="-1" aria-selected="false"><span data-tree-label="">README.md</span></li></ul></j3w1-tree>

Install and register

Use the exact version. If npm publication is pending, install the release tarball from the installation guide.

npm install --save-exact @j3w1/ui@4.0.0
import '@j3w1/ui/tokens.css';
import '@j3w1/ui/styles/tree.css';
import '@j3w1/ui/register/tree';

Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.

Vue SFC, React, Astro and plain HTML integration →

Copy the complete implementation

npx --package=@j3w1/ui@4.0.0 j3w1-ui copy tree --out ./vendor/j3w1/tree

The CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.

Public API

attributes

NameType / signatureMeaning
disabledCustomEventDisable the native controls owned by this instance.
loadingCustomEventMark the primary control busy and prevent duplicate activation.

properties

NameType / signatureMeaning
disabledbooleanDelegates disabled state to native children.
namestringNative control name; application form keys remain explicit.
selectedIdstringSelected treeitem ID.

methods

NameType / signatureMeaning
refresh(): voidReconnect behavior after replacing native child structure.
focus(options?: FocusOptions): voidFocus the first usable native control.
expand(id: string, expanded?: boolean): voidExpand or collapse a parent by ID.

events

NameType / signatureMeaning
j3w1-selectCustomEventThe user selected a visible enabled item.
j3w1-toggleCustomEventA parent expanded or collapsed.

Dependencies and verification

Registered components: none. Style dependencies: none.

Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.

Full implementation manifest, API and token dependency closure

Canonical specification

Tree tree

  • Family: Navigation
  • Maturity: stable
  • Priority: R2
  • Since: 1.0.0
  • Custom widget: treeview — APG pattern
  • specified
  • demonstrated

Hierarchical navigation with explicit expansion and one roving tab stop.

Report an issue with this component

Tokens

Focus a role to inspect its values; follow its link for persistent usage and source details.

PartRoleValueUse
root.bgcolor.surface.defaultapproveduse#0d0707D-041 surface.default: color.primitive.modern.panel.
root.textcolor.text.defaultapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
root.bordercolor.border.controlapproveduse#c81a1aD-041 owner correction: red control and floating-frame borders, distinct from rose text.
heading.textcolor.text.brightapproveduse#ffa2a7D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
secondary.textcolor.text.mutedapproveduse#d4868bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
control.bgcolor.surface.inputapproveduse#000000Form-control fill.
control.focuscolor.interaction.focus.ringobserveduse#e539351px dashed focus ring on controls and rows.
dependency.role-border-width-defaultborder.width.defaultobserveduse1pxEvery border is 1px.
dependency.role-border-width-emphasisborder.width.emphasisobserveduse2pxSelected indicator, sticky header rule, invalid border.
dependency.role-color-border-selected-indicatorcolor.border.selected-indicatorobserveduse#e539352px indicator bar on the selected tab or nav item.
dependency.role-color-interaction-selection-bgcolor.interaction.selection.bgapproveduse#531310Selected row, tab, workspace; D-027 recessed the fill, leaving the 2px indicator and the check to carry selection.
dependency.role-color-interaction-selection-textcolor.interaction.selection.textobserveduse#f4eeeeText on the selection.
dependency.role-color-text-disabledcolor.text.disabledapproveduse#a3676bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
dependency.role-density-comfortable-control-heightdensity.comfortable.control-heightobserveduse32px
dependency.role-density-compact-control-heightdensity.compact.control-heightobserveduse24px
dependency.role-focus-offsetfocus.offsetobserveduse-2pxoutline-offset for controls.
dependency.role-radius-noneradius.noneobserveduse0pxThe only radius. Nothing is rounded.
dependency.role-space-12space.12observeduse12px
dependency.role-space-16space.16observeduse16px
dependency.role-space-8space.8observeduse8px

State matrix

Every declared state and combination, statically rendered; the default cell is live. Sizes: compact, comfortable (switch with the density control above).

StateDefault
default
  • Source
    • App.vue
    • styles.css
  • README.md
selected
expanded
collapsed
focus-visible
disabled

Purpose

Navigates a hierarchy; selection and expansion are separate actions.

Anatomy

Parts as listed in the anatomy.

States

StateVisualNon-colour channel
defaultVisible named tree items.Tree and group hierarchy.
selectedSelected fill, text and start indicator.aria-selected.
expandedDownward marker and visible children.aria-expanded=true.
collapsedSide marker and hidden children.aria-expanded=false; children leave focus order.
focus-visibleDashed ring on the item’s own label.Roving native focus.
disabledDisabled text at full opacity.aria-disabled blocks selection.

Keyboard

As in the key table; only one visible item has tabindex=0.

Accessibility

Labels exclude descendant text. Collapsing a parent of the focused item moves focus to that parent.

Portability

Follows the shared component defaults in spec/portability.md (section “Shared component defaults”).

Non-examples

Unlabelled controls, color-only status, drag-only operations, hidden required instructions, stolen focus or an invented service success.

Contrast report

5 declared pairs measured on resolved sRGB values with the WCAG 2.x formula; 0 waived (decorative only), 0 failing. A pass is a design target for the named role, not an application-wide conformance claim.

PairStateKindForegroundBackgroundRatioMinResult
tree default textdefaulttextcolor.text.default #e99499color.surface.default #0d07078.724.5pass
tree default borderdefaultuicolor.border.control #c81a1acolor.surface.default #0d07073.443pass
Primary content—textcolor.text.default #e99499color.surface.default #0d07078.724.5pass
Supporting content—textcolor.text.muted #d4868bcolor.surface.default #0d07077.224.5pass
Control boundary—uicolor.border.control #c81a1acolor.surface.default #0d07073.443pass

Keys

KeyAction
Up / Down / Home / EndMove through visible items in source order.
Right / LeftExpand or enter a parent, collapse it or return to its parent. Mirror these keys in RTL.
Enter / SpaceSelect the focused enabled item.
TypingMove to the next visible label starting with the character.

For agents

Component JSON ·Implementation brief ·Build a task kit ·

Stress fixtures: FX-320 FX-360 FX-ZOOM-200 FX-I18N FX-RTL FX-RM FX-HC FX-TOUCH FX-DENSITY FX-STATE-MATRIX