` tag.
```html
...
```
--------------------------------
### Transfer List Item Count and Title
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/transfer/transfer-list/transfer-list.component.html
Displays the number of items and their pluralization, along with a translatable title. Uses async pipe for observable data.
```html
@if (numberOfItems$ | async; as numberOfItems) { {{ numberOfItems.length }} {{ (numberOfItems.length === 1 ? 'it.transfer.item' : 'it.transfer.items') | translate }} } {{ title | titlecase }}
```
--------------------------------
### Conditional Navigation Button Display
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/utils/error-page/error-page.component.html
Conditionally renders navigation buttons (back and home) if either showBackButton or showHomeButton is true. Includes specific logic for the home button text.
```html
@if (showBackButton || showHomeButton) {
@if (showBackButton) { } @if (showHomeButton) { {{ 'it.utils.error-page.go-to-homepage' | translate }} }
}
```
--------------------------------
### Update Angular Core and CLI Dependencies
Source: https://github.com/italia/design-angular-kit/blob/main/UPDATE_GUIDE.md
Update the `@angular/core` and `@angular/cli` packages to the target version using the Angular CLI command.
```bash
ng update @angular/core@21 @angular/cli@21
```
--------------------------------
### Iterating and Rendering Tabs
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/core/tab/tab-container/tab-container.component.html
Iterates over a collection of tabs, rendering each tab's label and conditionally displaying an icon or an editable state indicator.
```html
@if (tabs) {
@for (tab of tabs; track tab.id; let i = $index) {* @if (tab.icon) { } {{ tab.label }} @if (editable) { }
}
}
```
--------------------------------
### Disable Highlighting
Source: https://github.com/italia/design-angular-kit/blob/main/src/assets/lib/hljs/README.md
Use the `nohighlight` class to disable syntax highlighting for specific code blocks.
```html
...
```
--------------------------------
### Including Language Submodes in highlight.js
Source: https://github.com/italia/design-angular-kit/blob/main/src/assets/lib/hljs/CHANGES.md
Demonstrates how to include language submodes directly under 'contains' for auxiliary modes in highlight.js. This is useful for modes needed only in one place and may not generate separate spans if 'className' is omitted.
```javascript
contains: [
'string',
'number',
{begin: '\n', end: hljs.IMMEDIATE_RE}
]
```
--------------------------------
### Customize Bootstrap Italia SCSS Variables
Source: https://github.com/italia/design-angular-kit/blob/main/README.EN.md
Override default SCSS variables like colors and font families before importing the `bootstrap-italia.scss` file to customize the library's appearance.
```scss
// complete modification of the template: it is possible to recompile the library by modifying some SCSS variables
// For the override of the colour $primary of the HSB palette (colour #FF3333 https://rgb.to/ff3333):
$primary-h: 0;
$primary-s: 80;
$primary-b: 100;
// For the character family override
$font-family-serif: 'Custom Font', Georgia, serif;
$font-family-sans-serif: 'Custom Font', Arial, Helvetica, sans-serif;
$font-family-monospace: 'Custom Font', 'Courier New', Courier, monospace;
// Importing bootstrap-italia SCSS library
@import 'bootstrap-italia/src/scss/bootstrap-italia';
```
--------------------------------
### Web Worker - Worker Script
Source: https://github.com/italia/design-angular-kit/blob/main/src/assets/lib/hljs/README.md
The worker script that receives code content, imports highlight.js, performs highlighting, and posts the result back to the main thread.
```javascript
onmessage = function(event) {
importScripts('/highlight.pack.js');
var result = self.hljs.highlightAuto(event.data);
postMessage(result.value);
}
```
--------------------------------
### Button with End Icon
Source: https://github.com/italia/design-angular-kit/blob/main/src/app/button/button-example-icon/button-example-icon.component.html
Shows a button with an icon placed at the end. This configuration is useful for actions that follow text content.
```html
```
--------------------------------
### Input Component Template
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/input/input.component.html
This snippet shows the conditional rendering logic for labels, currency/percentage symbols, translation keys, descriptions, and validation messages within the Angular Input component's template.
```HTML
@if (label) { {{ label }} } @if (type === 'number') { @if (currency || percentage) { {{ symbol }} } {{ 'it.form.increase-value' | translate }} {{ 'it.form.decrease-value' | translate }} } @else { }
@if (description) { {{ description }} } @if (isInvalid) {
@if (!customError.hasChildNodes()) { {{ invalidMessage | async }} }
}
```
--------------------------------
### Dropdown Link HTML Structure
Source: https://github.com/italia/design-angular-kit/blob/main/src/app/dropdown/dropdown-link-example/dropdown-link-example.component.html
This snippet shows the HTML template for a dropdown link. It includes an iteration over items to display them and placeholders for open and close times.
```html
Apri dropdown @for (item of items; track item) { {{ item.text }} }
Open: {{ openTime }}
Close: {{ closeTime }}
```
--------------------------------
### Upload File List Template
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/upload-file-list/upload-file-list.component.html
The main template for the upload file list component, handling the display of files, buttons, and status messages based on various conditions.
```html
@if (!hideLoadButton) { @if (label) { {{ label }} } @else { {{ 'it.form.upload' | translate }} } } @if (fileList.length) {
@for (item of fileList; track item.id) {* @if (images) {
} @else { }
{{ 'it.form.uploaded-file' | translate: { name: item.file.name } }} {{ item.file.name }} {{ getFileSize(item.file) }}
@if (item.removable && (!item.progress || item.progress < 100)) { {{ 'it.form.delete-file' | translate: { name: item.file.name } }} } @if ((!item.removable && !item.progress) || (item.progress !== undefined && item.progress >= 100)) { {{ 'it.form.upload-complete' | translate }} } @if (!item.error && item.progress !== undefined && item.progress > 0 && item.progress < 100) { }
}
}
```
--------------------------------
### Search Component Template
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/search/search.component.html
The main template for the Search component, handling label display, asynchronous search results, and invalid state messages.
```html
@if (label) { {{ label }} } @if (searchResults$ | async as autocomplete) {
@for (entry of autocomplete.relatedEntries; track searchItemTrackByValueFn($index, entry)) {* @if (entry.avatarSrcPath) {
} @if (entry.icon) { } @if (entry.label) { _{{ entry.label }}_ }
}
} @if (isInvalid) {
@if (!customError.hasChildNodes()) { {{ invalidMessage | async }} }
}
```
--------------------------------
### Navigation Item Iteration and Conditional Rendering
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/navigation/navscroll/navscroll.component.html
Iterates through navigation items and conditionally renders titles based on their level using @switch.
```html
@for (item of items; track item.href) { } @switch (level) {
@case (1) {
{{ item.title }}
----------------
}
@case (2) {
### {{ item.title }}
}
@case (3) {
#### {{ item.title }}
}
@case (4) {
##### {{ item.title }}
}
@default {
###### {{ item.title }}
}
}
```
--------------------------------
### Conditional Rendering with Group States
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/checkbox/checkbox.component.html
Shows conditional rendering based on group and invalid states for the checkbox.
```html
@if (group) { } @if (isInvalid && group) {
}
```
--------------------------------
### Adding Editable Tabs
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/core/tab/tab-container/tab-container.component.html
Conditionally renders an 'Add a tab' link when the editable state is true, typically used for user-configurable tab interfaces.
```html
@if (editable) {* [Aggiungi un tab](#)
}
```
--------------------------------
### Provide DesignAngularKit with Custom TranslateLoader (Module)
Source: https://github.com/italia/design-angular-kit/blob/main/README.md
Configure ngx-translate to load both library and application translations using MultiTranslateHttpLoader when using the DesignAngularKitModule.forRoot method.
```typescript
import { HttpBackend } from '@angular/common/http';
import { TranslateLoader } from '@ngx-translate/core';
import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
import { DesignAngularKitModule } from 'design-angular-kit';
DesignAngularKitModule.forRoot({
translateLoader: (itPrefix: string, itSuffix: string) => ({
provide: TranslateLoader,
useFactory: (http: HttpBackend) =>
new MultiTranslateHttpLoader(http, [
{ prefix: itPrefix, suffix: itSuffix }, // Load library translations first, so you can edit the keys in your localization file
{ prefix: './assets/i18n/' }, // Your i18n location
]),
deps: [HttpBackend],
}),
});
```
--------------------------------
### Back Button HTML Structure
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/navigation/back-button/back-button.component.html
Defines the HTML structure for the back button component, conditionally rendering elements based on input properties like buttonStyle and showIcon. It also handles dynamic translation keys for the button's text.
```html
@if (buttonStyle === 'link') { [](#)} @if (buttonStyle === 'button') { } @if (showIcon) { } {{ (direction === 'left' ? 'it.navigation.go-back' : 'it.navigation.upper-level') | translate }}
```
--------------------------------
### Textarea Component Template
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/textarea/textarea.component.html
The template for the Textarea component includes conditional rendering for labels, descriptions, and error messages based on component properties.
```html
@if (label) { {{ label }} } @if (description) { {{ description }} } @if (isInvalid) {
@if (!customError.hasChildNodes()) { {{ invalidMessage | async }} }
}
```
--------------------------------
### Conditional Error Description Display
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/utils/error-page/error-page.component.html
Renders the error description, falling back to a translated default based on the errorCode if errorDescription is not provided and isDefaultErrorCode is true. Otherwise, it uses the provided errorDescription or a generic support message translation.
```html
@if (!errorDescription && isDefaultErrorCode) { {{ 'it.utils.error-page.' + errorCode + '.description' | translate }} } @else { {{ errorDescription || 'it.errors.generic-support-message' | translate }} }
```
--------------------------------
### Language Switcher HTML Structure
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/utils/language-switcher/language-switcher.component.html
This HTML template defines the structure for the language switcher. It displays the current language and conditionally renders a list of available languages with their labels and selection status.
```html
{{ 'it.utils.selected' | translate: { lang: (currentLang$ | async)?.label } }} {{ (currentLang$ | async)?.label || ('it.utils.select-language' | translate) }}
@if (availableLanguages) {
@for (lang of availableLanguages; track lang.code) {
{{ lang.label }}
@if (lang.code === (currentLang$ | async)?.code) {
{{ 'it.utils.selected' | translate }}
}
}
}
```
--------------------------------
### Conditional Search Bar Rendering
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/navigation/header/header.component.html
Renders the search bar element only when the 'showSearch' input is true.
```html
@if (showSearch) {
{{ 'it.navigation.search' | translate }}[](#)
}
```
--------------------------------
### Provide DesignAngularKit with Custom TranslateLoader (Function)
Source: https://github.com/italia/design-angular-kit/blob/main/README.md
Configure ngx-translate to load both library and application translations using MultiTranslateHttpLoader when using the provideDesignAngularKit function.
```typescript
import { HttpBackend } from '@angular/common/http';
import { TranslateLoader } from '@ngx-translate/core';
import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
import { provideDesignAngularKit } from 'design-angular-kit';
provideDesignAngularKit({
translateLoader: (itPrefix: string, itSuffix: string) => ({
provide: TranslateLoader,
useFactory: (http: HttpBackend) =>
new MultiTranslateHttpLoader(http, [
{ prefix: itPrefix, suffix: itSuffix }, // Load library translations first, so you can edit the keys in your localization file
{ prefix: './assets/i18n/' }, // Your i18n location
]),
deps: [HttpBackend],
}),
});
```
--------------------------------
### Import DesignAngularKitModule in Other Modules
Source: https://github.com/italia/design-angular-kit/blob/main/README.md
Use `forChild` when importing `DesignAngularKitModule` in other application modules to include all library components.
```typescript
import { DesignAngularKitModule } from 'design-angular-kit';
@NgModule({
imports: [...DesignAngularKitModule.forChild()],
exports: [DesignAngularKitModule],
})
export class SharedModule {}
```
--------------------------------
### Steppers Container HTML Template
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/core/steppers/steppers-container/steppers-container.component.html
The main HTML template for the Steppers Container component. It uses Angular's structural directives (@if, @for) to conditionally render steps, progress indicators, and navigation buttons.
```html
@if (showHeader) {
@if (steps) {
@for (step of steps; track step.id; let i = $index) {* @if (step.icon && !steppersNumber) { } @if (steppersNumber) { @if (i < activeStep) { } @else { {{ 'it.core.step' | translate }} {{ i + 1 }} } } {{ step.label }} @if (i < activeStep && !steppersNumber) { } @if (i === activeStep) { {{ 'it.core.active' | translate }} } }
} @if (steps) { @if (!steppersNumber) { {{ activeStep + 1 + '/' + steps.length }} } @else { @for (step of steps; track step.id; let i = $index) { {{ i + 1 }} } } }
}
@if (steps?.get(activeStep); as step) {
}
@if (showBackButton || showSaveButton || showForwardButton || showConfirmButton || !!progressStyle) {
@if (showBackButton) { {{ 'it.core.back' | translate }} }
@if (!!progressStyle && steps) {
@if (progressStyle === 'dots') {
@for (step of steps; track step; let i = $index) {*
{{ 'it.core.step-of' | translate: { current: activeStep + 1, available: steps?.length } }} {{ i < activeStep ? '- ' + (confirmedLabel ? confirmedLabel : ('it.core.confirmed' | translate)) : '' }}
}
}
} @if (showSaveButton) { {{ 'it.general.save' | translate }} }
@if (showForwardButton) { {{ 'it.core.forward' | translate }} }
@if (showConfirmButton) { {{ confirmedLabel ? confirmedLabel : ('it.core.confirmed' | translate) }}
}
}
{{ confirmedLabel ? confirmedLabel : ('it.core.confirmed' | translate) }}
```
--------------------------------
### Nested Navigation Item Iteration
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/navigation/navscroll/navscroll.component.html
Iterates through child items of a navigation item.
```html
@for (item of item.childs; track item.href) { }
```
--------------------------------
### Import Standalone Components in Standalone Component
Source: https://github.com/italia/design-angular-kit/blob/main/README.EN.md
Import standalone components directly into a standalone Angular component. This is the recommended approach for modern Angular applications, enabling tree-shakable component usage.
```typescript
import { ItAlertComponent, ItPaginationComponent, ItBreadcrumbsModule } from 'design-angular-kit';
@Component({
selector: 'app-product',
standalone: true,
imports: [ItAlertComponent, ItPaginationComponent, ItBreadcrumbsModule],
templateUrl: './product.component.html',
})
export class ProductComponent {}
```
--------------------------------
### Import Standalone Components in NgModule
Source: https://github.com/italia/design-angular-kit/blob/main/README.EN.md
Import specific standalone components like alerts, pagination, and breadcrumbs into your NgModule. This approach allows for a more granular inclusion of library features.
```typescript
import { ItAlertComponent, ItPaginationComponent, ItBreadcrumbsModule } from 'design-angular-kit';
@NgModule({
imports: [
ItAlertComponent,
ItPaginationComponent,
ItBreadcrumbsModule, // Includes ItBreadcrumbComponent and ItBreadcrumbItemComponent
],
})
export class YourAppModule {}
```
--------------------------------
### Angular Select Component Template
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/select/select.component.html
The core HTML template for the Angular Select component. It uses structural directives like @if and @for to dynamically render content based on component state.
```html
@if (label) { {{ label }} } @if (defaultOption) { {{ defaultOption }} } @if (options) { @for (option of options; track option.value) { {{ option.text ?? option.value }} } } @if (groups) { @for (group of groups; track group) { @for (option of group.options; track option.value) { {{ option.text ?? option.value }} } } } @if (description) { {{ description }} } @if (isInvalid) {
@if (!customError.hasChildNodes()) { {{ invalidMessage | async }} }
}
```
--------------------------------
### Chip Component Template
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/core/chip/chip.component.html
The HTML template for the Chip component. It uses Angular's structural directives (@if) to conditionally display elements such as an icon, an avatar, the label, and a close button. The label is displayed using interpolation, and the close button text is translated.
```html
@if (icon) { } @if (avatar) {
} {{ label }} @if (showCloseButton) { {{ 'it.core.remove' | translate }} {{ label }} }
```
--------------------------------
### Pagination Component Changer HTML Structure
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/core/pagination/pagination.component.html
This snippet illustrates the HTML for a 'jump to page' changer within the pagination component, utilizing Angular's @if and @for directives.
```html
@if (currentChanger !== undefined) { {{ currentChanger }} / {{ 'it.core.page' | translate | lowercase }} @for (value of changerValues; track value) {* {{ value }} / {{ 'it.core.page' | translate | lowercase }}
}
}
@if (showJumpToPage) { }
```
--------------------------------
### Conditional Navigation Display
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/navigation/navscroll/navscroll.component.html
Conditionally renders navigation elements based on 'hideNavigationOnMobile' and 'isNotMobile' states.
```html
@if (!hideNavigationOnMobile || (isNotMobile | async)) {
{{ selectedTitle | async }}
Chiudi
Indietro
@if (headerAsAccordion) {
### {{ header }}
} @else {
### {{ header }}
}
}
```
--------------------------------
### Displaying Label Conditionally
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/checkbox/checkbox.component.html
Conditionally displays a label when a custom label element has no child nodes.
```html
@if (!customLabel.hasChildNodes()) { {{ label }} }
```
--------------------------------
### Nested Accordion Structure
Source: https://github.com/italia/design-angular-kit/blob/main/src/app/accordion/accordion-nested-example/accordion-nested-example.component.html
This HTML template shows a parent accordion group containing multiple nested accordion items. It includes event binding to capture the 'shown' and 'hidden' events emitted by the accordion components.
```html
This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element and the overall accordion layout.
Nested item content 1.
Nested item content 2.
This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element and the overall accordion layout.
This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element and the overall accordion layout.
Ultimo evento shown emesso da = {{ shownComponent }}
Ultimo evento hidden emesso da = {{ hiddenComponent }}
```
--------------------------------
### Pagination Component HTML Structure
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/core/pagination/pagination.component.html
This snippet shows the main HTML structure for the pagination component, using Angular's structural directives like @if and @for for conditional rendering.
```html
@if (pages.length) {
* [@if (!textLinks) { } {{ (textLinks ? 'it.core.page' : 'it.core.previous-page') | translate }} @if (textLinks) { {{ 'it.core.previous' | translate }} }](#)
@if (simpleMode) {* {{ currentPage + 1 }}
* /
* {{ pageNumbers }}
* [{{ 'it.core.page-of-total' | translate: { page: currentPage + 1, total: pageNumbers } }}](#)
}
@else {
@if (pageNumbers > visiblePages && pages[0] >= 2) {* [1](#)
@if (pages[0] >= 3) {* ...
}
}
@for (page of pages; track page) {* @if (page === currentPage + 1) { [{{ 'it.core.page' | translate }} {{ page }}](#) } @else { [{{ page }}](#) }
}
@if (pageNumbers > visiblePages && pages[pages.length - 1] < pageNumbers) {
@if (pages[pages.length - 1] < pageNumbers - 1) {* ...
}
* [{{ pageNumbers }}](#)
}
}
* [{{ (textLinks ? 'it.core.page' : 'it.core.next-page') | translate }} @if (textLinks) { {{ 'it.core.next' | translate }} } @else { }](#)
}
```
--------------------------------
### Conditional Rendering for Invalid State without Group
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/checkbox/checkbox.component.html
Illustrates conditional rendering when the checkbox is invalid but not part of a group.
```html
@if (isInvalid && !group) {
}
```
--------------------------------
### Radio Button Template Structure
Source: https://github.com/italia/design-angular-kit/blob/main/projects/design-angular-kit/src/lib/components/form/radio-button/radio-button.component.html
Basic template structure for an Angular radio button component. It conditionally displays a label or an invalid message based on component states.
```html
@if (!customLabel.hasChildNodes()) { {{ label }} } @if (group) { } @if (isInvalid && group) {
@if (!customError.hasChildNodes()) { {{ invalidMessage | async }} }
}
@if (isInvalid && !group) {
@if (!customError.hasChildNodes()) { {{ invalidMessage | async }} }
}
```