src/components/sq-tooltip/sq-tooltip.component.ts
Represents a tooltip component for displaying informative messages.
Look the link about the component in original framework and the appearance
See https://css.squidit.com.br/components/tooltip
Example :<sq-tooltip placement='center top' message='This is a tooltip message.'></sq-tooltip>
selector | sq-tooltip |
styleUrls | ./sq-tooltip.component.scss |
templateUrl | ./sq-tooltip.component.html |
Inputs |
color | |
Type : string
|
|
Default value : ''
|
|
The background color of the tooltip. |
fontSize | |
Type : string
|
|
Default value : '1rem'
|
|
The font size of the tooltip content. |
icon | |
Type : string
|
|
Default value : ''
|
|
The name of the icon to display in the tooltip. |
message | |
Type : string
|
|
Default value : ''
|
|
The message to display in the tooltip. |
placement | |
Type : string
|
|
Default value : 'center top'
|
|
The placement of the tooltip (e.g., 'center top'). See https://css.squidit.com.br/components/tooltip |
textAlign | |
Type : string
|
|
Default value : 'text-center'
|
|
The text alignment within the tooltip. |
tooltipClass | |
Type : string
|
|
Default value : ''
|
|
Additional CSS classes for styling the tooltip. |
trigger | |
Type : "hover" | "click"
|
|
Default value : 'hover'
|
|
The tooltip trigger Possible values: 'hover' or 'click'. |
import { Component, Input } from '@angular/core'
/**
* Represents a tooltip component for displaying informative messages.
*
* Look the link about the component in original framework and the appearance
*
* @see {@link https://css.squidit.com.br/components/tooltip}
*
* @example
* <sq-tooltip placement='center top' message='This is a tooltip message.'></sq-tooltip>
*
*/
@Component({
selector: 'sq-tooltip',
templateUrl: './sq-tooltip.component.html',
styleUrls: ['./sq-tooltip.component.scss'],
})
export class SqTooltipComponent {
/**
* The background color of the tooltip.
*/
@Input() color = ''
/**
* The name of the icon to display in the tooltip.
*/
@Input() icon = ''
/**
* The placement of the tooltip (e.g., 'center top').
* @see {@link https://css.squidit.com.br/components/tooltip}
*/
@Input() placement = 'center top'
/**
* The message to display in the tooltip.
*/
@Input() message = ''
/**
* Additional CSS classes for styling the tooltip.
*/
@Input() tooltipClass = ''
/**
* The text alignment within the tooltip.
*/
@Input() textAlign = 'text-center'
/**
* The font size of the tooltip content.
*/
@Input() fontSize = '1rem'
/**
* The tooltip trigger
* Possible values: 'hover' or 'click'.
*/
@Input() trigger: 'hover' | 'click' = 'hover'
}
<ng-template #tooltip>
<div class="{{ textAlign }} {{ tooltipClass }}" [innerHTML]="message"></div>
</ng-template>
<div
[class]="'wrapper-tooltip {{ color }}'"
[placement]="placement"
[tooltip]="message"
[trigger]="trigger"
[ngStyle]="{
color: color,
'font-size': fontSize
}"
>
<div class="icon" *ngIf="icon" [innerHtml]="icon | universalSafe"></div>
<i
class="fa-solid fa-circle-question icon"
*ngIf="!icon"
></i>
</div>
./sq-tooltip.component.scss
.wrapper-tooltip {
display: inline-block;
cursor: help;
}