Your search did not match any results.


The Box component allows you to create layouts of any complexity. You can arrange multiple blocks (items) horizontally or vertically, specify relative or absolute block sizes, and nest layouts within each other.

Set the Box's width and height properties to specify the layout's overall dimensions. To add blocks, use the items array, the dataSource property, or specify dxItems in the markup.

This demo shows how to use the Box component to create three different layouts.

The first Box sets direction to row and thus arranges items horizontally. Items use the ratio property to set their width in relative units.

The second Box shows two additional features:

  • Items now use the baseSize property to set their width in pixels or percent.
  • The middle item contains a nested Box. The align and crossAlign properties make sure that the nested layout is centered within its container.

The third Box demonstrates a layout similar to a basic web page structure. The root layout sets direction to col and arranges its items vertically. The nested layout is arranged horizontally.

Backend API
Copy to CodePen
const DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', ($scope) => { $scope.boxOptions1 = { direction: 'row', width: '100%', height: 75, }; $scope.boxOptions2 = { direction: 'row', width: '100%', height: 75, align: 'center', crossAlign: 'center', }; $scope.boxOptions3 = { direction: 'col', width: '100%', height: 250, }; $scope.boxOptions4 = { direction: 'row', width: '100%', height: 125, }; });
<!DOCTYPE html> <html xmlns=""> <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" /> <script src=""></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <script src=""></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script> <script src=""></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div dx-box="boxOptions1"> <div class="rect demo-dark" data-options="dxItem: {ratio: 1}"> ratio = 1 </div> <div class="rect demo-light" data-options="dxItem: {ratio: 2}"> ratio = 2 </div> <div class="rect demo-dark" data-options="dxItem: {ratio: 1}"> ratio = 1 </div> </div> <br /> <div dx-box="boxOptions1"> <div class="rect demo-dark" data-options="dxItem: {ratio: 0, baseSize: 150}"> 150px </div> <div class="demo-light" data-options="dxItem: {ratio: 1}"> <div dx-box="boxOptions2"> <div data-options="dxItem: {ratio: 0, baseSize: 50}"> <div class="small"></div> </div> <div data-options="dxItem: {ratio: 0, baseSize: 50}"> <div class="small"></div> </div> <div data-options="dxItem: {ratio: 0, baseSize: 50}"> <div class="small"></div> </div> </div> </div> <div class="rect demo-dark" data-options="dxItem: {ratio: 0, baseSize: '10%'}"> 10% </div> </div> <br /> <div dx-box="boxOptions3"> <div class="rect demo-dark header" data-options="dxItem: {ratio: 1}"> Header </div> <div data-options="dxItem: {ratio: 2, baseSize: 0}"> <div dx-box="boxOptions4"> <div class="rect demo-dark" data-options="dxItem: {ratio: 1}"> Left Bar </div> <div class="rect demo-light" data-options="dxItem: {ratio: 1}"> Content </div> <div class="rect demo-dark" data-options="dxItem: {ratio: 1}"> Right Bar </div> </div> </div> <div class="rect demo-dark footer" data-options="dxItem: {ratio: 1}"> Footer </div> </div> </div> </body> </html>
.rect { text-align: center; font-size: 30px; padding-top: 10px; height: 100%; } .demo-light { background: rgba(245, 229, 166, 0.5); } .demo-dark { background: rgba(148, 215, 199, 0.5); } .demo-dark.header { background: rgba(243, 158, 108, 0.5); } .demo-dark.footer { background: rgba(123, 155, 207, 0.5); } .small { height: 50px; border: 1px solid lightgray; }