CodeTree

GitHub
Visualize file and folder structures with syntax-highlighted code.

Usage

Wrap your code blocks with a code-tree component in any particular order to display a tree view of your files.

app/app.config.ts
export default defineAppConfig({
  pohon: {
    colors: {
      primary: 'sky',
      colors: 'slate'
    }
  }
});
::code-tree{defaultValue="app/app.config.ts"}

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['pohon-ui'],

  css: ['~/assets/css/main.css']
})

```

```css [app/assets/css/main.css]
body {
  @apply min-h-screen;
}
```

```ts [app/app.config.ts]
export default defineAppConfig({
  pohon: {
    colors: {
      primary: 'sky',
      colors: 'slate'
    }
  }
})
```

```vue [app/app.vue]
<template>
  <PApp>
    <NuxtPage />
  </PApp>
</template>
```

```json [package.json]
{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "typecheck": "nuxt typecheck"
  },
  "dependencies": {
    "@iconify-json/lucide": "^1.2.18",
    "@nuxt/ui": "^4.0.0",
    "nuxt": "^4.0.0"
  },
  "devDependencies": {
    "typescript": "^5.8.2",
    "vue-tsc": "^2.2.10"
  }
}
```

```json [tsconfig.json]
{
  "extends": "./.nuxt/tsconfig.json"
}
```

````md [README.md]
# Nuxt 4 Minimal Starter

Look at the [Nuxt 4 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# npm
npm install

# pnpm
pnpm install

# bun
bun install
```

## Development server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm run dev

# bun
bun run dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm run build

# bun
bun run build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm run preview

# bun
bun run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
````

::
Like the ProsePre component, the CodeTree handles filenames, icons and copy button.

API

Props

Prop Default Type

Slots

Slot Type

Theme

We use unocss-variants to customize the theme. Read more about it in the theming guide.

Below is the theme configuration skeleton for the ProseCodeTree. Since the component is provided unstyled by default, you will need to fill in these values to apply your own custom look and feel. If you prefer to use our pre-built, opinionated styling, you can instead use our UnoCSS preset, this docs is using it as well.

app.config.ts
export default defineAppConfig({
  pohon: {
    prose: {
      codeTree: {
        slots: {
          root: '',
          list: '',
          item: '',
          listWithChildren: '',
          itemWithChildren: '',
          link: '',
          linkLeadingIcon: '',
          linkLabel: '',
          linkTrailing: '',
          linkTrailingIcon: '',
          content: ''
        },
        variants: {
          active: {
            true: {
              link: ''
            },
            false: {
              link: ''
            }
          }
        }
      }
    }
  }
};
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pohon from 'pohon-ui/vite'

export default defineAppConfig({
  pohon: {
    prose: {
      codeTree: {
        slots: {
          root: '',
          list: '',
          item: '',
          listWithChildren: '',
          itemWithChildren: '',
          link: '',
          linkLeadingIcon: '',
          linkLabel: '',
          linkTrailing: '',
          linkTrailingIcon: '',
          content: ''
        },
        variants: {
          active: {
            true: {
              link: ''
            },
            false: {
              link: ''
            }
          }
        }
      }
    }
  }
};

Changelog

No recent changes