Vue3 Org Chart is a simple and lightweight organization chart component for Vue3. It is highly customizable.
![image](https://private-user-images.githubusercontent.com/712404/346598110-b168b58c-dc63-4968-93f8-f3e76cc5ccae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjU3MjAsIm5iZiI6MTczODk2NTQyMCwicGF0aCI6Ii83MTI0MDQvMzQ2NTk4MTEwLWIxNjhiNThjLWRjNjMtNDk2OC05M2Y4LWYzZTc2Y2M1Y2NhZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwN1QyMTU3MDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hNTA0MzA3ZTVjZmM0NDQyYWIxYjQxYWUyMzU2N2ZkNzg4OWM1YTgzM2JkZTNhM2ViNzI2ODVkNjgwMjg3YzAxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.jGiDb4czV9A9sOA5O0p5KbmdArADmUtrTbIbaxKjA-k)
Playground : https://playcode.io/vue3orgchart
Demo : https://vue3orgchart.playcode.io
npm i vue3-org-chart
JS entry point
import { createApp } from 'vue'
import App from './App.vue'
import { Vue3OrgChartPlugin } from 'vue3-org-chart'
import 'vue3-org-chart/dist/style.css'
const app = createApp(App)
app.use(Vue3OrgChartPlugin)
app.mount('#app')
// alternatively, you can import the component directly
// to use component, Vue3OrgChart instead of Vue3OrgChartPlugin
<script setup>
import { Vue3OrgChart } from 'vue3-org-chart'
import 'vue3-org-chart/dist/style.css'
// ...
</script>
for more detailed example, please check the examples folder
<div>
<vue3-org-chart json="YOUR_DATA_JSON_URL">
<template #node="{item, children, open, toggleChildren}">
<!-- Node Element / TEMPLATE START -->
<div>{{item.name}}</div>
<button v-if="children.length" @click="toggleChildren"> {{ open ? '-' : '+' }}</button>
<!-- Node Element / TEMPLATE END -->
</template>
</vue3-org-chart>
</div>
You have full control over node elements, In addition to that there are some css variables for lines and container height or node spacing..
:root {
--vue3-org-chart-container-height: 70vh;
--vue3-org-chart-line-top: .5rem;
--vue3-org-chart-line-bottom: .5rem;
--vue3-org-chart-node-space-x: .5rem;
--vue3-org-chart-line-color: blue;
}
If you want to contribute to the project, please feel free to fork the repository and submit your changes as a pull request. Ensure that the changes you submit are applicable for general use rather than specific to your project.
Copyright (c) 2024 Yusuf ÖZDEMİR, released under the MIT license