Angular UI Components Documentation

Angular DockingLayout Component

The DockingLayout component for Angular which allows the creation of complex layouts with panels that can be floated, docked, nested, resized, pinned, unpinned and closed.

1. Installation

The easiest way to get started with jQWidgets UI for Angular is to use the Angular CLI Tool. To scaffold your project structure, follow its installation instructions.

npm install -g @angular/cli
ng new jqwidgets-project
cd jqwidgets-project

Install jQWidgets

jQWidgets Angular UI comes packaged with Angular CLI schematics to make creating Angular applications easier. Schematics are included with both @angular/cdk and jqwidgets-ng. Once you install the npm packages, they will be available through the Angular CLI.

Angular CLI supports the addition of packages through the ng add command. The ng add command provides faster and more user-friendly package installation. To install the jQWidgets UI for Angular package, use ng add and add the name of the NPM package:

ng add jqwidgets-ng

Alternatively, you can use the standard installation (Manual Setup)

jQWidgets UI for Angular is distributed as jqwidgets-ng NPM package

  1. Download and install the package.
    npm install jqwidgets-ng
  2. Adding CSS reference

    The following CSS file is available in ../node_modules/jqwidgets-ng/ package folder. This can be referenced in [src/styles.css] using following code.

    @import 'jqwidgets-ng/jqwidgets/styles/jqx.base.css';

    Another way to achieve the same is to edit the angular.json file and in the styles add the style.

    "styles": [
    	"node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css"
    ]
    

2. Add the HTML for jQWidgets component in src/app/app.component.html

app.component.html


<jqxDockingLayout [theme]="'fluent'" #dockingLayoutReference [width]="getWidth()" [height]='600' [layout]='layout'>
    <!--The panel content divs can have a flat structure-->
    <!--autoHideGroup-->
    <div data-container="ToolboxPanel">
      List of tools
    </div>
    <div data-container="HelpPanel">
      Help topics
    </div>
    <!--documentGroup-->
    <div data-container="Document1Panel">
      Document 1 content
    </div>
    <div data-container="Document2Panel">
      Document 2 content
    </div>
    <!--bottom tabbedGroup-->
    <div data-container="ErrorListPanel">
      List of errors
    </div>
    <!--right tabbedGroup-->
    <div data-container="SolutionExplorerPanel">
      <div id="treeContainer" style="border: none;"></div>
    </div>
    <div data-container="PropertiesPanel">
      List of properties
    </div>
    <!--floatGroup-->
    <div data-container="OutputPanel">
      <div style="font-family: Consolas;">
        <p>
          Themes installation complete.
        </p>
        <p>
          List of installed stylesheet files. Include at least one stylesheet Theme file and
          the images folder:
        </p>
        <ul>
          <li>
            styles/jqx.base.css: Stylesheet for the base Theme. The jqx.base.css file should
            be always included in your project.
          </li>
          <li>styles/jqx.arctic.css: Stylesheet for the Arctic Theme</li>
          <li>styles/jqx.web.css: Stylesheet for the Web Theme</li>
          <li>styles/jqx.bootstrap.css: Stylesheet for the Bootstrap Theme</li>
          <li>styles/jqx.classic.css: Stylesheet for the Classic Theme</li>
          <li>styles/jqx.darkblue.css: Stylesheet for the DarkBlue Theme</li>
          <li>styles/jqx.energyblue.css: Stylesheet for the EnergyBlue Theme</li>
          <li>styles/jqx.shinyblack.css: Stylesheet for the ShinyBlack Theme</li>
          <li>styles/jqx.office.css: Stylesheet for the Office Theme</li>
          <li>styles/jqx.metro.css: Stylesheet for the Metro Theme</li>
          <li>styles/jqx.metrodark.css: Stylesheet for the Metro Dark Theme</li>
          <li>styles/jqx.orange.css: Stylesheet for the Orange Theme</li>
          <li>styles/jqx.summer.css: Stylesheet for the Summer Theme</li>
          <li>styles/jqx.black.css: Stylesheet for the Black Theme</li>
          <li>styles/jqx.fresh.css: Stylesheet for the Fresh Theme</li>
          <li>styles/jqx.highcontrast.css: Stylesheet for the HighContrast Theme</li>
          <li>styles/jqx.blackberry.css: Stylesheet for the Blackberry Theme</li>
          <li>styles/jqx.android.css: Stylesheet for the Android Theme</li>
          <li>styles/jqx.mobile.css: Stylesheet for the Mobile Theme</li>
          <li>styles/jqx.windowsphone.css: Stylesheet for the Windows Phone Theme</li>
          <li>styles/jqx.ui-darkness.css: Stylesheet for the UI Darkness Theme</li>
          <li>styles/jqx.ui-lightness.css: Stylesheet for the UI Lightness Theme</li>
          <li>styles/jqx.ui-le-frog.css: Stylesheet for the UI Le Frog Theme</li>
          <li>styles/jqx.ui-overcast.css: Stylesheet for the UI Overcast Theme</li>
          <li>styles/jqx.ui-redmond.css: Stylesheet for the UI Redmond Theme</li>
          <li>styles/jqx.ui-smoothness.css: Stylesheet for the UI Smoothness Theme</li>
          <li>styles/jqx.ui-start.css: Stylesheet for the UI Start Theme</li>
          <li>styles/jqx.ui-sunny.css: Stylesheet for the UI Sunny Theme</li>
          <li>styles/images: contains images referenced in the stylesheet files</li>
        </ul>
      </div>
    </div>
</jqxDockingLayout>	

3. Setup Component Logic

app.component.ts


import { Component } from '@angular/core';


import { jqxDockingLayoutModule, jqxDockingLayoutComponent } from 'jqwidgets-ng/jqxdockinglayout';
@Component({
    selector: 'app-root',
    imports: [jqxDockingLayoutModule],
    standalone: true,
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})


export class AppComponent {
    layout: any[] = this.generateLayout();

    getWidth(): any {
        if (document.body.offsetWidth < 800) {
            return '90%';
        }

        return 800;
    }

    generateLayout(): any[] {
        let layout = [
            {
                type: 'layoutGroup',
                orientation: 'horizontal',
                items: [{
                    type: 'autoHideGroup',
                    alignment: 'left',
                    width: 80,
                    unpinnedWidth: 200,
                    items: [{
                        type: 'layoutPanel',
                        title: 'Toolbox',
                        contentContainer: 'ToolboxPanel'
                    }, {
                        type: 'layoutPanel',
                        title: 'Help',
                        contentContainer: 'HelpPanel'
                    }]
                },
                {
                    type: 'layoutGroup',
                    orientation: 'vertical',
                    width: 222,
                    items: [{
                        type: 'documentGroup',
                        height: 400,
                        minHeight: 200,
                        items: [{
                            type: 'documentPanel',
                            title: 'Document 1',
                            contentContainer: 'Document1Panel'
                        },
                        {
                            type: 'documentPanel',
                            title: 'Document 2',
                            contentContainer: 'Document2Panel'
                        }]
                    },
                    {
                        type: 'tabbedGroup',
                        height: 200,
                        pinnedHeight: 30,
                        items: [{
                            type: 'layoutPanel',
                            title: 'Error List',
                            contentContainer: 'ErrorListPanel'
                        }]
                    }]
                },
                {
                    type: 'tabbedGroup',
                    width: 220,
                    minWidth: 200,
                    items: [
                        {
                            type: 'layoutPanel',
                            title: 'Solution Explorer',
                            contentContainer: 'SolutionExplorerPanel',
                            initContent: () => {
                                // initialize a jqxTree inside the Solution Explorer Panel
                                let source = [{
                                    icon: 'https://www.jqwidgets.com/angular/images/earth.png',
                                    label: 'Project',
                                    expanded: true,
                                    items: [
                                        {
                                            icon: 'https://www.jqwidgets.com/angular/images/folder.png',
                                            label: 'css',
                                            expanded: true,
                                            items: [{
                                                icon: 'https://www.jqwidgets.com/angular/images/nav1.png',
                                                label: 'jqx.base.css'
                                            },
                                            {
                                                icon: 'https://www.jqwidgets.com/angular/images/nav1.png',
                                                label: 'jqx.energyblue.css'
                                            }, {
                                                icon: 'https://www.jqwidgets.com/angular/images/nav1.png',
                                                label: 'jqx.orange.css'
                                            }]
                                        },
                                        {
                                            icon: 'https://www.jqwidgets.com/angular/images/folder.png',
                                            label: 'scripts',
                                            items: [{
                                                icon: 'https://www.jqwidgets.com/angular/images/nav1.png',
                                                label: 'jqxcore.js'
                                            },
                                            {
                                                icon: 'https://www.jqwidgets.com/angular/images/nav1.png',
                                                label: 'jqxdata.js'
                                            }, {
                                                icon: 'https://www.jqwidgets.com/angular/images/nav1.png',
                                                label: 'jqxgrid.js'
                                            }]
                                        },
                                        {
                                            icon: 'https://www.jqwidgets.com/angular/images/nav1.png',
                                            label: 'index.htm'
                                        }]
                                }];

                                jqwidgets.createInstance('#treeContainer', 'jqxTree', { theme: 'material', width: '100%', height: '99%', source: source })
                            }
                        },
                        {
                            type: 'layoutPanel',
                            title: 'Properties',
                            contentContainer: 'PropertiesPanel'
                        }]
                }]
            },
            {
                type: 'floatGroup',
                width: 500,
                height: 300,
                position: {
                    x: 100,
                    y: 250
                },
                items: [{
                    type: 'layoutPanel',
                    title: 'Output',
                    contentContainer: 'OutputPanel',
                    selected: true
                }]
            }];
        return layout;
    }
}

Summary

jQWidgets UI for Angular provides an easy way to integrate robust UI components into your Angular project. By using either the ng add command or manual setup, you can quickly get started. Once the setup is complete, you can add the desired jQWidgets components and configure them in your Angular components to match your application requirements.

DockingLayout API

API Reference of the jQWidgets DockingLayout component for Angular: DockingLayout API