Your search did not match any results.
Accordion

Accordion

Documentation

The Accordion widget contains several panels displayed one under another. These panels can be collapsed or expanded by a user, which makes this widget very useful for presenting information in a limited amount of space.

Copy to CodeSandBox
Apply
Reset
<template> <div id="accordion"> <dx-accordion :data-source="companies" :collapsible="collapsible" :multiple="multiple" :animation-duration="animationDuration" :selected-items.sync="selectedItems" > <template #title="{ data }"> <custom-title :item-data="data"/> </template> <template #item="{ data }"> <custom-item :item-data="data"/> </template> </dx-accordion> <div class="selected-data"> <span class="caption">Selected Items</span> <dx-tag-box :data-source="companies" :value.sync="selectedItems" :disabled="!multiple" display-expr="CompanyName" /> </div> <div class="options"> <div class="caption">Options</div> <div class="option"> <dx-check-box :value.sync="multiple" text="Multiple enabled" /> </div> <div class="option"> <dx-check-box :value.sync="collapsible" text="Collapsible enabled" /> </div> <div class="option"> <span>Animation duration</span> <dx-slider :min="0" :max="1000" :value.sync="animationDuration" > <dx-tooltip :enabled="true" position="bottom" /> <dx-label :visible="true"/> </dx-slider> </div> </div> </div> </template> <script> import { DxAccordion, DxTagBox, DxCheckBox } from 'devextreme-vue'; import DxSlider, { DxTooltip, DxLabel } from 'devextreme-vue/slider'; import CustomTitle from './CustomTitle.vue'; import CustomItem from './CustomItem.vue'; import service from './data.js'; export default { components: { DxAccordion, DxTagBox, DxCheckBox, DxSlider, DxTooltip, DxLabel, CustomTitle, CustomItem }, data() { const companies = service.getCompanies(); return { companies, selectedItems: [companies[0]], multiple: false, collapsible: false, animationDuration: 300 }; } }; </script> <style scoped> #accordion h1 { font-size: 20px; } #accordion h1, #accordion p { margin: 0; } .dx-theme-material #accordion .dx-accordion-item-opened .dx-accordion-item-title { display: flex; } .dx-theme-material #accordion .dx-accordion-item-opened h1 { align-self: center; } .options, .selected-data { padding: 20px; background-color: rgba(191, 191, 191, 0.15); margin-top: 20px; } .selected-data { position: relative; height: 36px; } .selected-data > .caption { position: relative; top: 5px; margin-right: 10px; font-weight: bold; font-size: 115%; } .selected-data > .dx-widget { position: absolute; left: 140px; right: 20px; top: 20px; } .options > .caption { font-weight: 500; font-size: 18px; } .option { margin-top: 10px; } </style>
<template> <div> <div> <p> <b>{{ itemData.City }}</b> (<span>{{ itemData.State }}</span>) </p> <p> <span>{{ itemData.Zipcode }}</span> <span>{{ itemData.Address }}</span> </p> </div> <div> <p> Phone: <b>{{ itemData.Phone }}</b> </p> <p> Fax: <b>{{ itemData.Fax }}</b> </p> <p> Website: <a :href="itemData.Website" target="_blank" > {{ itemData.Website }} </a> </p> </div> </div> </template> <script> export default { props: { itemData: { type: Object, default: () => {} } } }; </script>
<template> <h1>{{ itemData.CompanyName }}</h1> </template> <script> export default { props: { itemData: { type: Object, default: () => {} } } }; </script>
import Vue from 'vue'; import App from './App.vue'; new Vue({ el: '#app', components: { App }, template: '<App/>' });
<!DOCTYPE html> <html> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.light.css" /> <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script> <script src="https://unpkg.com/systemjs@0.21.3/dist/system.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('./index.js'); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> </body> </html>
const companies = [{ 'ID': 1, 'CompanyName': 'Super Mart of the West', 'Address': '702 SW 8th Street', 'City': 'Bentonville', 'State': 'Arkansas', 'Zipcode': 72716, 'Phone': '(800) 555-2797', 'Fax': '(800) 555-2171', 'Website': 'http://www.nowebsitesupermart.com' }, { 'ID': 2, 'CompanyName': 'Electronics Depot', 'Address': '2455 Paces Ferry Road NW', 'City': 'Atlanta', 'State': 'Georgia', 'Zipcode': 30339, 'Phone': '(800) 595-3232', 'Fax': '(800) 595-3231', 'Website': 'http://www.nowebsitedepot.com' }, { 'ID': 3, 'CompanyName': 'K&S Music', 'Address': '1000 Nicllet Mall', 'City': 'Minneapolis', 'State': 'Minnesota', 'Zipcode': 55403, 'Phone': '(612) 304-6073', 'Fax': '(612) 304-6074', 'Website': 'http://www.nowebsitemusic.com' }, { 'ID': 4, 'CompanyName': "Tom's Club", 'Address': '999 Lake Drive', 'City': 'Issaquah', 'State': 'Washington', 'Zipcode': 98027, 'Phone': '(800) 955-2292', 'Fax': '(800) 955-2293', 'Website': 'http://www.nowebsitetomsclub.com' }]; export default { getCompanies() { return companies; } };
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': 'https://unpkg.com/' }, map: { vue: 'npm:vue@2.6.3/dist/vue.esm.browser.js', 'vue-loader': 'npm:dx-systemjs-vue-browser@latest/index.js', 'devextreme': 'npm:devextreme@19.2', 'devextreme-vue': 'npm:devextreme-vue@19.2', jszip: 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.7/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', 'devexpress-gantt': 'npm:devexpress-gantt', 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js' }, meta: { '*.vue': { loader: 'vue-loader' } }, packages: { 'devextreme-vue': { main: 'index.js' }, 'devextreme': { defaultExtension: 'js' } }, babelOptions: { sourceMaps: false, stage0: true } });