Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                  <body class="dx-viewport">
    <div class="demo-container">
      <div id="center-content">
        <div id="demo-items-container">
          <div class="content dx-fieldset">
            <div class="dx-field">
              <div class="tabs-container"></div>
            </div>

            <div class="dx-field select-box-container">
              <div class="dx-field-label">Selected user:</div>
              <div class="dx-field-value">
                <div id="selectbox"></div>
              </div>
            </div>

            <div class="dx-field multiview-container">
              <div id="multiview"></div>
            </div>

            <div class="icon-container">
              <span class="dx-icon dx-icon-info"></span>
              <span class="demo-info">You can use swipe gestures in this area.</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
              
            
!

CSS

              
                #center-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.select-box-container,
.multiview-container {
  padding: 16px;
}

#demo-items-container {
  width: 680px;
}

.employee-info {
  display: flex;
  align-items: center;
}

.employee-photo {
  height: 80px;
  width: 80px;
  border-radius: 50%;
  border-width: 1px;
  border-style: solid;
  flex-shrink: 0;
  object-fit: contain;
  margin-right: 24px;
  border-color: var(--dx-color-border);
}

.employee-notes b {
  display: inline-block;
  margin-bottom: 8px;
}

.dx-field-label {
  font-size: 16px;
}

#multiview {
  cursor: move;
}

.demo-info {
  padding-left: 8px;
  opacity: 0.6;
}

.icon-container {
  padding-left: 16px;
  display: flex;
  align-items: center;
}

.dx-icon {
  font-size: 18px;
}

              
            
!

JS

              
                $(() => {
  const tabsInstance = $('.tabs-container').dxTabs({
    dataSource: employees,
    selectedItem: employees[0],
    onSelectionChanging(e) {
      const itemText = e.addedItems[0].text;

      e.cancel = DevExpress.ui.dialog
        .confirm(`This will display information about ${itemText}`, "Change tab?")
        .then(isChangeConfirmed => {
          const isCanceled = !isChangeConfirmed;
          if(isCanceled){
            const previousSelectedItem = e.removedItems[0]; 
            selectBox.option({ value: previousSelectedItem });
            multiView.option({ selectedItem: previousSelectedItem });
          }        
          return isCanceled;
        });
    },
    onSelectionChanged({ component }) {
      const { selectedItem } = component.option();

      selectBox.option({ value: selectedItem });
      multiView.option({ selectedItem });
    },
  }).dxTabs('instance');

  const selectBox = $('#selectbox').dxSelectBox({
    value: employees[0],
    dataSource: employees,
    inputAttr: { 'aria-label': 'Select Employee' },
    displayExpr: 'text',
    onValueChanged({ value }) {
      tabsInstance.option('selectedItem', value);
    },
  }).dxSelectBox('instance');

  const multiView = $('#multiview').dxMultiView({
    height: 112,
    width: '100%',
    dataSource: employees,
    selectedItem: employees[0],
    loop: false,
    animationEnabled: true,
    itemTemplate(data, index, element) {
      const $note = $('<div>')
        .addClass('employee-info')
        .append($(`<img alt="${data.text}" class="employee-photo" src="${data.picture}"/>`))
        .append($('<p>').addClass('employee-notes').append($(`<b>Position: ${data.position}</b><br/>`)).append(data.notes));

      element.append($note);
    },
    onSelectionChanged({ component }) {
      const { selectedItem } = component.option();

      tabsInstance.option({ selectedItem });
    },
  }).dxMultiView('instance');
});
const employees = [
  {
    id: 0,
    icon: 'user',
    text: 'John Heart',
    position: 'CEO',
    picture: 'https://js.devexpress.com/jQuery/Demos/WidgetsGallery/JSDemos/images/employees/01.png',
    notes: 'John has been in the Audio/Video industry since 1990. He has led DevAv as its CEO since 2003. When not working hard as the CEO, John loves to golf and bowl. He once bowled a perfect game of 300.',
  },
  {
    id: 1,
    icon: 'user',
    text: 'Olivia Peyton',
    position: 'Sales Assistant',
    picture: 'https://js.devexpress.com/jQuery/Demos/WidgetsGallery/JSDemos/images/employees/09.png',
    notes: 'Olivia loves to sell. She has been selling DevAV products since 2012.  Olivia was homecoming queen in high school. She is expecting her first child in 6 months. Good Luck Olivia.',
  },
  {
    id: 2,
    icon: 'user',
    text: 'Robert Reagan',
    position: 'CMO',
    picture: 'https://js.devexpress.com/jQuery/Demos/WidgetsGallery/JSDemos/images/employees/03.png',
    notes: 'Robert was recently voted the CMO of the year by CMO Magazine. He is a proud member of the DevAV Management Team. Robert is a championship BBQ chef, so when you get the chance ask him for his secret recipe.',
  },
];

              
            
!
999px

Console