ToolbarToolbar is a grouping component for buttons and other content.

Toolbar - 图1

Documentation

Import

  1. import {ToolbarModule} from 'primeng/toolbar';
  2.  

Getting Started

Toolbar is a container component defined using p-toolbar element. Left aligned content is placed inside a div having .ui-toolbar-group-left class and similarly .ui-toolbar-group-right for right alignment.

  1. <p-toolbar>
  2. <div class="ui-toolbar-group-left">
  3. <button pButton type="button" label="New" icon="pi pi-plus"></button>
  4. <button pButton type="button" label="Upload" icon="pi pi-upload" class="ui-button-success"></button>
  5. <i class="pi pi-bars"></i>
  6. <p-splitButton label="Save" icon="pi pi-check" [model]="items" styleClass="ui-button-warning"></p-splitButton>
  7. </div>
  8. <div class="ui-toolbar-group-right">
  9. <button pButton type="button" icon="pi pi-search"></button>
  10. <button pButton type="button" icon="pi pi-calendar" class="ui-button-success"></button>
  11. <button pButton type="button" icon="pi pi-times" class="ui-button-danger"></button>
  12. </div>
  13. </p-toolbar>
  14.  

Properties

NameTypeDefaultDescription
stylestringnullInline style of the component.
styleClassstringnullStyle class of the component.

Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
ui-toolbarMain container element.
ui-toolbar-group-leftLeft content container.
ui-toolbar-group-rightRight content container.

Dependencies

None.

Source

View on GitHub

  1. <p-toolbar>
  2. <div class="ui-toolbar-group-left">
  3. <button pButton type="button" label="New" icon="pi pi-plus"></button>
  4. <button pButton type="button" label="Upload" icon="pi pi-upload" class="ui-button-success"></button>
  5. <i class="ui-toolbar-separator pi pi-bars" style="vertical-align: middle"></i>
  6. <p-splitButton label="Save" icon="pi pi-check" [model]="items" styleClass="ui-button-warning"></p-splitButton>
  7. </div>
  8. <div class="ui-toolbar-group-right">
  9. <button pButton type="button" icon="pi pi-search"></button>
  10. <button pButton type="button" icon="pi pi-calendar" class="ui-button-success"></button>
  11. <button pButton type="button" icon="pi pi-times" class="ui-button-danger"></button>
  12. </div>
  13. </p-toolbar>
  14.