Dock is a navigation component consisting of menuitems.
import { DockModule } from 'primeng/dock';
Dock requires a collection of menuitems as its model. Default location is bottom and other sides are also available when defined with the position property. Content of the dock component is defined by item template.
<p-dock [model]="items" [position]="position">
<ng-template pTemplate="item" let-item>
<img [src]="item.icon" [alt]="item.label" width="100%" />
</ng-template>
</p-dock>
Dock requires a collection of menuitems as its model. Default location is bottom and other sides are also available when defined with the position property. Content of the dock component is defined by item template.
<p-menubar [model]="menubarItems">
<ng-template pTemplate="start">
<i class="pi pi-apple"></i>
</ng-template>
<ng-template pTemplate="end">
<i class="pi pi-video"></i>
<i class="pi pi-wifi"></i>
<i class="pi pi-volume-up"></i>
<span>Fri 13:07</span>
<i class="pi pi-search"></i>
<i class="pi pi-bars"></i>
</ng-template>
</p-menubar>
<div class="dock-window dock-advanced">
<p-dock [model]="dockItems" position="bottom">
<ng-template pTemplate="item" let-item>
<img [src]="item.icon" [alt]="item.label" width="100%" />
</ng-template>
</p-dock>
<p-toast></p-toast>
<p-dialog [(visible)]="displayFinder" [breakpoints]="{ '960px': '50vw' }" [style]="{ width: '30vw', height: '18rem' }" [draggable]="false" [resizable]="false">
<p-tree [value]="nodes"></p-tree>
</p-dialog>
<p-dialog [maximizable]="true" [(visible)]="displayTerminal" [breakpoints]="{ '960px': '50vw' }" [style]="{ width: '30vw' }" [draggable]="false" [resizable]="false">
<p-terminal welcomeMessage="Welcome to PrimeNG (cmd: 'date', 'greet {0}', 'random')" prompt="primeng $"></p-terminal>
</p-dialog>
<p-galleria
[(value)]="images"
[showThumbnails]="false"
[showThumbnailNavigators]="false"
[showItemNavigators]="true"
[(visible)]="displayGalleria"
[circular]="true"
[responsiveOptions]="responsiveOptions"
[containerStyle]="{ 'max-width': '850px' }"
[circular]="true"
[fullScreen]="true"
>
<ng-template pTemplate="item" let-item>
<img [src]="item.previewImageSrc" style="width: 100%; display: block;" />
</ng-template>
</p-galleria>
</div>
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
p-dock | Container element. |
p-dock-list | List of items. |
p-dock-item | Each items in list. |
Dock component uses the menu role with the aria-orientation and the value to describe the menu can either be provided with aria-labelledby or aria-label props. Each list item has a presentation role whereas anchor elements have a menuitem role with aria-label referring to the label of the item and aria-disabled defined if the item is disabled.
Key | Function |
---|---|
tab | Add focus to the first item if focus moves in to the menu. If the focus is already within the menu, focus moves to the next focusable item in the page tab sequence. |
shift + tab | Add focus to the last item if focus moves in to the menu. If the focus is already within the menu, focus moves to the previous focusable item in the page tab sequence. |
enter | Activates the focused menuitem. |
space | Activates the focused menuitem. |
down arrow | Moves focus to the next menuitem in vertical layout. |
up arrow | Moves focus to the previous menuitem in vertical layout. |
home | Moves focus to the first menuitem in horizontal layout. |
end | Moves focus to the last menuitem in horizontal layout. |
API defines helper props, events and others for the PrimeNG Dock module.
Name | Type | Default | Description |
---|---|---|---|
id | string | null | Unique identifier of the element. |
styleClass | string | null | Style class of the element. |
style | object | null | Inline style of the element. |
model | object | null | MenuModel instance to define the action items. |
position | string | bottom | Position of element. Valid values are 'bottom', 'top', 'left' and 'right'. |
Name | Parameters | Description |
---|---|---|
toggle | event: browser event | Toggles the visibility of the popup menu. |
show | event: browser event | Displays the popup menu. |
hide | - | Hides the popup menu. |
Name | Parameters | Description |
---|---|---|
onShow | event: Event object | Callback to invoke when overlay menu is shown. |
onHide | event: Event object | Callback to invoke when overlay menu is hidden. |
MenuItem provides the following properties. Note that not all of them may be utilized by the dock component.
Name | Type | Default | Description |
---|---|---|---|
id | string | null | Identifier of the element. |
label | string | null | Text of the item. |
icon | string | null | Icon of the item. |
iconStyle | object | null | Inline style of the item's icon. |
command | function | null | Callback to execute when item is clicked. |
url | string | null | External link to navigate when item is clicked. |
routerLink | array | null | RouterLink definition for internal navigation. |
routerLinkActiveOptions | object | null | Configuration for active router link. |
queryParams | object | null | Query parameters for internal navigation via routerLink. |
fragment | string | null | Sets the hash fragment for the URL. |
queryParamsHandling | QueryParamsHandling | null | How to handle query parameters in the router link for the next navigation. One of: merge : Merge new with current parameters. preserve : Preserve current parameters.k. |
preserveFragment | boolean | false | When true, preserves the URL fragment for the next navigation. |
skipLocationChange | boolean | null | When true, navigates without pushing a new state into history. |
replaceUrl | boolean | null | When true, navigates while replacing the current state in history. |
state | object | null | Developer-defined state that can be passed to any navigation. |
items | array | null | An array of children menuitems. |
expanded | boolean | false | Visibility of submenu. |
disabled | boolean | false | When set as true, disables the menuitem. |
visible | boolean | true | Whether the dom element of menuitem is created or not. |
target | string | null | Specifies where to open the linked document. |
escape | boolean | true | Whether to escape the label or not. Set to false to display html content. |
separator | boolean | false | Defines the item as a separator. |
style | object | null | Inline style of the menuitem. |
styleClass | string | null | Style class of the menuitem. |
badge | string | null | Value of the badge. |
badgeStyleClass | string | null | Style class of the badge. |
title | string | null | Tooltip text of the item. |
automationId | any | null | Value of HTML data-* attribute. |
tabindex | string | 0 | Specifies tab order of the item. |
tooltipOptions | TooltipOptions | - | Options of the item's tooltip. |