A simple Vue component to beautify tree-like visualizations.
- Render tree-like structures in a visually appealing way.
- Fully customizable and lightweight.
- Supports scoped styles for seamless integration.
Install the package via npm:
npm install @tlylt/vue-tree
or yarn:
yarn add @tlylt/vue-tree
Import and register the component in your Vue application:
import { createApp } from 'vue';
import App from './App.vue';
import { VueTree } from '@tlylt/vue-tree';
const app = createApp(App);
app.use(VueTree);
app.mount('#app');
Use indentation (2 spaces) to indicate the level of nesting:
<template>
<VueTree>
C:/course/
textbook/
index.md
index.md
reading.md
site.json
</VueTree>
</template>
Expected:
C:/course/
├── textbook/
│ └── index.md
├── index.md
├── reading.md
└── site.json
To use this component, you must configure whitespace: 'preserve'
in the Vue compiler options. This ensures that the tree structure is rendered correctly.
Add the following to your vite.config.ts
:
plugins: [vue(
{
template: {
compilerOptions: {
whitespace: "preserve",
},
}
}
)],
If you are using Vue programmatically, configure the compiler options as follows:
const app = Vue.createApp({
compilerOptions: {
whitespace: 'preserve'
}
});
WIP
Add details about the props supported by the component.
WIP
Document any events emitted by the component.
WIP
Explain the slots available for customization.
WIP
Provide details on how to customize the component, such as styles or additional options.
This project is licensed under the MIT License. See the LICENSE file for details.