Theme

Start Here

Start from the smallest working snippet, then move to interactive examples and the full API contract below.

Styled quick start

Copy this entrypoint first. It includes the imports required to get the component on screen.

svelte
<script lang="ts">
  import '@dryui/ui/themes/default.css';
  import '@dryui/ui/themes/dark.css';
  import { Tree } from '@dryui/ui';
</script>

<Tree.Root>
  <Tree.Item>...</Tree.Item>
  <Tree.ItemLabel>...</Tree.ItemLabel>
  <Tree.ItemChildren>...</Tree.ItemChildren>
</Tree.Root>

Import options

Root package

ts
import { Tree } from '@dryui/ui'

Per-component subpath

ts
import { Tree } from '@dryui/ui/tree'

Customize

Use the interactive examples to see common variants, states, and composition patterns before building your own.

Default

src
svelte
<script lang="ts">
  let selectedItem = $state(null);
</script>
<Tree.Root defaultExpanded={['src']} bind:selectedItem>
  <Tree.Item itemId="src">
    <Tree.ItemLabel>src</Tree.ItemLabel>
    <Tree.ItemChildren>
      <Tree.Item itemId="src/lib">
        <Tree.ItemLabel>lib</Tree.ItemLabel>
        <Tree.ItemChildren>
          <Tree.Item itemId="src/lib/utils.ts">
            <Tree.ItemLabel>utils.ts</Tree.ItemLabel>
          </Tree.Item>
          <Tree.Item itemId="src/lib/index.ts">
            <Tree.ItemLabel>index.ts</Tree.ItemLabel>
          </Tree.Item>
        </Tree.ItemChildren>
      </Tree.Item>
      <Tree.Item itemId="src/app.svelte">
        <Tree.ItemLabel>app.svelte</Tree.ItemLabel>
      </Tree.Item>
    </Tree.ItemChildren>
  </Tree.Item>
  <Tree.Item itemId="package.json">
    <Tree.ItemLabel>package.json</Tree.ItemLabel>
  </Tree.Item>
</Tree.Root>

Structure

Compound components always start with Tree.Root. Use this structure block to understand required wrappers before you wire state or styling.

Tree.Root
  Tree.Item
  Tree.ItemLabel
  Tree.ItemChildren
Tree.Root Tree.ItemTree.ItemLabelTree.ItemChildren

Compose

The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.

Compound component. Start with Tree.Root, then add only the parts you need.

Tree.ItemTree.ItemLabelTree.ItemChildren

Tree.Root

Prop Type Default Required Bindable
defaultExpanded
string[]
selectedItem
string | null
null
children
Snippet

Forwards <div> attributes via rest props. Common examples: id, style, role.

Tree.Item

Prop Type Default Required Bindable
itemId
string
children
Snippet

Forwards <div> attributes via rest props. Common examples: id, style, role.

Tree.ItemLabel

Prop Type Default Required Bindable
children
Snippet

Forwards <div> attributes via rest props. Common examples: id, style, role.

Tree.ItemChildren

Prop Type Default Required Bindable
children
Snippet

Forwards <div> attributes via rest props. Common examples: id, style, role.