![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
vue-multilevel-accordion
Advanced tools
> An extremely customizable multi level accordion. It's receives a high level tree structure in json format.
An extremely customizable multi level accordion. It's receives a high level tree structure in json format.
The above reasons led me to build an extremely customizable recursive accordion.
npm i vue-multilevel-accordion
<script>
import MultilevelAccordion from "vue-multilevel-accordion";
import tree from "./tree.js";
export default {
components: {
MultilevelAccordion
},
data() {
return {
tree
};
}
};
</script>
const tree = {
text: "Root",
children: [
{
text: "Musicians",
children: [
{
text: "IDM",
children: [
{
text: "Ae"
},
{
text: "BOC"
}
]
},
{
text: "Post Rock",
children: [
{
text: "Tortoise"
}
]
}
]
}
]
};
export { tree };
For example, this is going to show text field defined previously in every tab. Also, when the user clicks on the tab, the method select(value) will be called.
<template slot-scope="{ tree }">
<div @click="select(tree.text)" style="padding: 10px;">
<p>{{ tree.text }}</p>
</div>
</template>
<multilevel-accordion :tree="tree" :marginLeft="2">
<template slot-scope="{ tree }">
<div @click="select(tree.text)">
<p>{{ tree.text }}</p>
</div>
</template>
</multilevel-accordion>
The component receives 2 posible props:
<multilevel-accordion :tree="tree" :marginLeft="2"> </multilevel-accordion>
Prop | Type | Default | Description |
---|---|---|---|
tree | Object | null | Contains the tree in json format that's required to render the component. |
marginLeft | Float | 0 | It's the accumulative margin on the left that growths with each level. Is in rem units. |
For each element in the tree some properties can be individually accesed via slot-scope directive.
<multilevel-accordion :tree="tree" :marginLeft="2">
<template slot-scope="{ tree, interleaved, level, expanded, leaf }">
<div>
<p>{{ tree.text }}</p>
</div>
</template>
</multilevel-accordion>
Field | Type | Description |
---|---|---|
tree | Object | Contains the fields defined in the tree structure. |
interleaved | Boolean | Alternates between true and false depending on the row. It can be use to select a background color, for example. |
level | Number | Integer that indicates the depth level of the row. |
expanded | Boolean | Is true if the row is expanded, else otherwise. |
leaf | Boolean | Is true if the tab is a leaf (doesnt have any children element), false otherwise. You can override this default behaviour by adding leaf: true or leaf: false in the tree structure for each element. |
Important:
In this repository there is a functional example that you can run locally in your pc. Please go to the example folder and follow the instructions.
Adding some styling you can quickly scalate the complexity of the component and the design.
For example, you can:
This is done with the { interleaved } destructuring.
This can be done with the { leaf } destructuring: leaf is going to be true if the element is a leaf, and false otherwise. Combine this with v-if or conditionals.
This can be done with the { expanded } destructuring, which is going to be true is the tab is expanded and false otherwise.
This can be done with the { level } destructuring which is an Integer that represents the current level of depth.
For example, using this component and the library Tailwind Css you could reach pretty different styles:
You can run locally in your computer the following examples. To do this, just go to the github repository and clone the folder example. To install, follow the instructions listed on the readme file of that folder.
Example 1:
Example 2:
Example 3:
This is a pretty basic project that I did in a weekend. If you want to contribute improving this, adding more functionality of fixing issues I'll be glad to receive PR.
MIT License
Copyright (c) 2019 Santiago Díaz de Valdés Williamson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
> An extremely customizable multi level accordion. It's receives a high level tree structure in json format.
The npm package vue-multilevel-accordion receives a total of 75 weekly downloads. As such, vue-multilevel-accordion popularity was classified as not popular.
We found that vue-multilevel-accordion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.