Skip to content

Commit

Permalink
Merge pull request #11556 from cetincakiroglu/issue-11502
Browse files Browse the repository at this point in the history
Fixed #11502 - Tooltip | fit-content support
  • Loading branch information
mertsincan authored May 31, 2022
2 parents 2908cf3 + e2cbd85 commit a3a2bea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class Tooltip implements AfterViewInit, OnDestroy {

@Input() positionLeft: number;

@Input() fitContent: boolean = true;

@Input('pTooltip') text: string;

@Input("tooltipDisabled") get disabled(): boolean {
Expand Down Expand Up @@ -300,6 +302,10 @@ export class Tooltip implements AfterViewInit, OnDestroy {
DomHandler.appendChild(this.container, this.getOption('appendTo'));

this.container.style.display = 'inline-block';

if (this.fitContent) {
this.container.style.width = 'fit-content';
}
}

show() {
Expand Down
6 changes: 6 additions & 0 deletions src/app/showcase/components/tooltip/tooltipdemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ <h5>Properties</h5>
<td>right</td>
<td>Position of the tooltip, valid values are right, left, top and bottom.</td>
</tr>
<tr>
<td>fitContent</td>
<td>boolean</td>
<td>true</td>
<td>Automatically adjusts the element position when there is not enough space on the selected position.</td>
</tr>
<tr>
<td>tooltipEvent</td>
<td>string</td>
Expand Down

0 comments on commit a3a2bea

Please sign in to comment.