Компоненты PrimeNG
Sidebar

Сайдбар

PrimeNG/Sidebar (opens in a new tab)

Боковая панель - это панель, отображаемая в виде наложения по краям экрана.

С чего начать

Подключите модуль

import { SidebarModule } from 'primeng/sidebar';

В .ts файле

import { Component, OnInit } from '@angular/core';
 
@Component({
  selector: 'app-prime-sidebar',
  templateUrl: './prime-sidebar.component.html',
  styleUrls: ['./prime-sidebar.component.scss']
})
export class PrimeSidebarComponent implements OnInit {
 
  visibleSidebar1: any;
  visibleSidebar2: any;
  visibleSidebar3: any;
  visibleSidebar4: any;
  visibleSidebar5: any;
 
  constructor() { }
 
  ngOnInit(): void {
  }
}

Встройте компонент с помощью тэга p-sidebar.

Sidebar

Свойства

NameTypeDefaultDescription
visiblebooleanfalseSpecifies the visibility of the dialog.
positionstringleftSpecifies the position of the sidebar, valid values are "left", "right", "bottom" and "top".
fullScreenbooleanfalseAdds a close icon to the header to hide the dialog.
appendToanynullTarget element to attach the dialog, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
stylestringnullInline style of the component.
styleClassstringnullStyle class of the component.
blockScrollbooleanfalseWhether to block scrolling of the document when sidebar is active.
baseZIndexnumber0Base zIndex value to use in layering.
autoZIndexbooleantrueWhether to automatically manage layering.
modalbooleantrueWhether an overlay mask is displayed behind the sidebar.
dismissiblebooleantrueWhether to dismiss sidebar on click of the mask.
showCloseIconbooleantrueWhether to display the close icon.
transitionOptionsstring150ms cubic-bezier(0, 0, 0.2, 1)Transition options of the animation.
ariaCloseLabelstringcloseAria label of the close icon.
closeOnEscapebooleantrueSpecifices if pressing escape key should hide the sidebar.

События

NameParametersDescription
onShowevent: Event objectCallback to invoke when dialog is shown.
onHideevent: Event objectCallback to invoke when dialog is hidden.

Шаблоны

NameParameters
content-

Стилизация

NameElement
p-sidebarContainer element
p-sidebar-leftContainer element of left sidebar.
p-sidebar-rightContainer element of right sidebar.
p-sidebar-topContainer element of top sidebar.
p-sidebar-bottomContainer element of bottom sidebar.
p-sidebar-fullContainer element of a full screen sidebar.
p-sidebar-activeContainer element when sidebar is visible.
p-sidebar-closeClose anchor element.
p-sidebar-smSmall sized sidebar.
p-sidebar-mdMedium sized sidebar.
p-sidebar-lgLarge sized sidebar.
p-sidebar-maskModal layer of the sidebar.