Naming Conventions

How components, directives and templates are named in ExhaustiveUI. Tests check these rules on every change.

A component is written as an element whose name is p- followed by the name of the component in kebab case: every word of the name is separated by a hyphen, as the Angular style guide recommends. A name made of a single word stays one word, such as p-checkbox, p-listbox or p-menubar. The parts of a component follow the same rule.

<p-date-picker [(ngModel)]="date" />
<p-multi-select [options]="cities" [(ngModel)]="selectedCities" />

<p-icon-field>
    <p-input-icon class="pi pi-search" />
    <input pInputText placeholder="Search" />
</p-icon-field>

<p-tabs value="0">
    <p-tab-list>
        <p-tab value="0">Header I</p-tab>
    </p-tab-list>
    <p-tab-panels>
        <p-tab-panel value="0">Content I</p-tab-panel>
    </p-tab-panels>
</p-tabs>

A directive enhances an element you write yourself, so it is an attribute, not an element. Its name is p followed by the name of the directive in camel case, as Angular attributes are: pInputText on an input, pButton on a button, pTooltip on any element. There is no p-input-text element: InputText is the pInputText directive.

The directives that only make sense inside a TreeTable row keep the tt prefix of TreeTable, such as ttRow and ttSortableColumn.

<input pInputText [(ngModel)]="value" />
<textarea pTextarea [(ngModel)]="text"></textarea>
<button pButton pTooltip="Save the form" type="submit"><span pButtonLabel>Save</span></button>

A template is an ng-template placed inside the component, with a reference that names it, such as #header or #item. The Templates section of the API reference of each component lists the exact names, read from the source code of the component, with the context each template receives through let- variables. Names are case sensitive: write them exactly as listed, for example #disabledDate on the DatePicker.

<p-table [value]="products">
    <ng-template #header let-columns>
        <tr>
            <th>Name</th>
            <th>Price</th>
        </tr>
    </ng-template>
    <ng-template #body let-product let-rowIndex="rowIndex">
        <tr>
            <td>{{ product.name }}</td>
            <td>{{ product.price }}</td>
        </tr>
    </ng-template>
</p-table>

Earlier versions accepted several spellings of the same element, such as p-datePicker and p-datepicker for p-date-picker, without the kebab case form being available everywhere. These spellings still work in v22, so existing templates keep working, but the documentation, the examples and the generated code only use the kebab case form. Every component accepts the kebab case form.

UseInstead of
p-date-pickerp-datePicker, p-datepicker
p-input-iconp-inputIcon, p-inputicon
p-file-uploadp-fileUpload, p-fileupload
p-tree-tablep-treeTable, p-treetable
p-sort-iconp-sortIcon