Overview of IntegralUI SideBar

IntegralUI SideBar is a native web component for Angular, React and Vue that allows you to add a custom content panel that appears by sliding from page side over main content. In this article, you will find general information about the sidebar component, including its properties, events and methods that you can use.

SideBar component is part of IntegralUI Web
a suite of UI Components for development of web apps

If you have any questions, don't hesitate to contact us at support@lidorsystems.com

Using different properties from control panel, you can choose the side at which the SideBar is placed, whether animations are active or disabled, the animation speed and whether the side bar content will appear over main page content or before it.

Popup property determines whether the sidebar content appears over page content or it is placed before it. If the SideBar is placed on right or bottom side, the content will always appear over the page content.

The Header is created from a template and it is fully customizable. You can place text, command buttons or other components like a Menu to it.

How to Use IntegralUI SideBar in Angular, React and Vue

To use the SideBar component you need to do the following:

  • In app template place the button component using the iui-sidebar tag name
  • Set values for different properties available
  • Handle the component events
<iui-sidebar>
    <ng-template let-obj [iuiTemplate]="{ type: 'header' }"></ng-template>
    <ng-template let-obj [iuiTemplate]="{ type: 'content' }"></ng-template>
</iui-sidebar>
                                    

SideBar component has two parts: header and content. You can customize the sidebar by adding custom HTML elements or other web components inside header and/or content template. You can arrange these elements in custom layouts specified on your side. In this example, the header has a title and the content has a multiline text with two buttons on the bottom.

public data: any;
public barSize: any = { width: 300, height: 400 }
public barTitle: string = "SideBar Header";
                            
constructor(){
    this.data = { 
        body: 'Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor.'
    }
} 
                                    
<iui-sidebar [appRef]="applicationRef" [data]="data" [size]="barSize" [title]="barTitle" #bar>
    <ng-template let-obj [iuiTemplate]="{ type: 'header' }">
        <div class="sidebar-ovw-header">
            <span class="sidebar-ovw-header-title">{{barTitle}}</span>
        </div>
    </ng-template>
    <ng-template let-obj [iuiTemplate]="{ type: 'content' }">
        <div class="sidebar-ovw-content">
            <span>{{data.body}}</span><br/>
            <div class="sidebar-ovw-content-buttons">
                <button (click)="btnOk()">Ok</button>
                <button (click)="btnCancel()">Cancel</button>
            </div>
        </div>
    </ng-template>
</iui-sidebar>
                                    
/* Bar Header and Content */
.sidebar-ovw-header {
    padding: 0;
}
.sidebar-ovw-header-title {
    display: inline-block;
    margin: 3px 0 0 2px;
}
.sidebar-ovw-content {
    padding: 10px;
    font-family: Calibri, Tahoma, Arial, Helvetica, sans-serif;
    font-size: 1.1em;
}
.sidebar-ovw-content-buttons {
    position: absolute;
    bottom: 10px;
    right: 5px;
}
.sidebar-ovw-content-buttons button {
    margin: 0 5px;
    padding: 3px;
    width: 75px;
}
                                    

Note If header contains only a text, then instead of using a template, you can simple provide a header text to the title property. In this case, the header template is not required.

By default, the sidebar will appear on the page left side, but you can change the placement property and set the side at which the sidebar will be placed. Depending on the chosen placement, the sidebar content will appear accordingly: left placement will show the content on right, top placement will show content below etc.

public barPlacementOptions: any = [
    { text: 'Top', value: IntegralUIPlacement.Top },
    { text: 'Right', value: IntegralUIPlacement.Right },
    { text: 'Bottom', value: IntegralUIPlacement.Bottom },
    { text: 'Left', value: IntegralUIPlacement.Left }
];
                                                    
constructor(){
    . . .

    this.currentBarPlacement = this.barPlacementOptions[3];
} 
                                    
<iui-sidebar [appRef]="applicationRef" [data]="data" [size]="barSize" [title]="barTitle" [placement]="currentBarPlacement.value" #bar>
    <ng-template let-obj [iuiTemplate]="{ type: 'header' }">
        <div class="sidebar-ovw-header">
            <span class="sidebar-ovw-header-title">{{barTitle}}</span>
        </div>
    </ng-template>
    <ng-template let-obj [iuiTemplate]="{ type: 'content' }">
        <div class="sidebar-ovw-content">
            <span>{{data.body}}</span><br/>
            <div class="sidebar-ovw-content-buttons">
                <button (click)="btnOk()">Ok</button>
                <button (click)="btnCancel()">Cancel</button>
            </div>
        </div>
    </ng-template>
</iui-sidebar>
                                    

If you want to have a sidebar where the content appears over other elements on your page, then you need to set the popup property to true. This will make sure the sidebar content pops over the page content.

For other sidebar functionalities, check out the property list below.

List of Available Properties, Events and Methods in IntegralUI SideBar

Supported Properties

You can use the following properties to change the appearance and behavior of the SideBar component:

  • allowAnimation - determines whether changes to the SideBar are animated or not
  • animationSpeed - specifies the speed by which the animations are processed
  • appRef - holds a reference to the application view
  • controlStyle - specifies an object that contains all style settings for the component
  • data - specifies an object that holds data related to the component
  • enabled - determines whether button is enabled or disabled
  • expanded - specifies whether the SideBar is expanded or collapsed
  • name - uniquely identifies the component
  • placement - specifies the page side at which SideBar is placed
  • popup - determines whether the SideBar content will appear over other page content
  • size - specifies the component width and height
  • state - specifies the component state: disabled, hovered, etc.
  • title - a text placed in the component header

Using the above properties, you can customize the SideBar component in a way best suited for your application.

Supported Events

Here is a list of available events:

  • enabledChanged - occurs when component is enabled or disabled
  • sizeChanged - occurs when component size changes
  • stateChanged - occurs when component state changed: disabled, normal, hovered, selected

Supported Methods

The following public methods are available:

  • close - shows the sidebar content
  • open - hides the sidebar content
  • updateLayout - updates the component layout

You can use above methods to manually open or close the sidebar content, for example based on a click from a custom toolbar on your page.

In this example, the sidebar is closed whenever the Ok or Cancel button is clicked from within the custom content template:

import { IntegralUISideBar } from './integralui/components/integralui.sidebar';

. . .

@ViewChild('bar', { static: false }) bar: IntegralUISideBar;

btnOk(){
    this.bar.close();
}

btnCancel(){
    this.bar.close();
}
                                    
<iui-sidebar [appRef]="applicationRef" [data]="data" [size]="barSize" [title]="barTitle" [placement]="currentBarPlacement.value" #bar>
    <ng-template let-obj [iuiTemplate]="{ type: 'header' }">
        <div class="sidebar-ovw-header">
            <span class="sidebar-ovw-header-title">{{barTitle}}</span>
        </div>
    </ng-template>
    <ng-template let-obj [iuiTemplate]="{ type: 'content' }">
        <div class="sidebar-ovw-content">
            <span>{{data.body}}</span><br/>
            <div class="sidebar-ovw-content-buttons">
                <button (click)="btnOk()">Ok</button>
                <button (click)="btnCancel()">Cancel</button>
            </div>
        </div>
    </ng-template>
</iui-sidebar>
                                    

How to Customize the SideBar Appearance

You can modify the SideBar appearance by changing the attributes of several built-in CSS classes. To enhance the component, you can add your own custom CSS classes that will override the default appearance.

For this purpose, you can use the controlStyle property, where you need to specify the names of your CSS classes, for the state that you want to change: disabled, focused, hovered, normal and selected:

sideBarStyle = {
    general: {
        disabled: 'iui-sidebar-disabled',
        focused: 'iui-sidebar-focused',
        normal: 'iui-sidebar',
        hovered: 'iui-sidebar-hovered',
        selected: 'iui-sidebar-selected'
    }
}
                    

In this example, custom CSS classes are provided for sidebar header and content within their templates.

/* Bar Header and Content */
.sidebar-ovw-header {
    padding: 0;
}
.sidebar-ovw-header-title {
    display: inline-block;
    margin: 3px 0 0 2px;
}
.sidebar-ovw-content {
    padding: 10px;
    font-family: Calibri, Tahoma, Arial, Helvetica, sans-serif;
    font-size: 1.1em;
}
.sidebar-ovw-content-buttons {
    position: absolute;
    bottom: 10px;
    right: 5px;
}
.sidebar-ovw-content-buttons button {
    margin: 0 5px;
    padding: 3px;
    width: 75px;
}
                                    

To disable animations, you can simply set the allowAnimation property to false.

Conclusion

IntegralUI SideBar is a web component that you can use in Angular, React and Vue. It allows you to place a custom content on page side that will appear on demand. Using different properties and methods and by providing your own CSS classes, you can customize the component appearance and behavior.

The SideBar component is part of IntegralUI Web.

Newsletter


Sign-up to our newsletter and you will receive news on upcoming events, latest articles, samples and special offers.
Name: Email: *
*By checking this box, I agree to receive a newsletter from Lidor Systems in accordance with the Privacy Policy. I understand that I can unsubscribe from these communications at any time by clicking on the unsubscribe link in all emails.