Skip to content

Commit

Permalink
Merge pull request #2585 from tugcekucukoglu/fitContent
Browse files Browse the repository at this point in the history
Fixed #2536 - Tooltip new fitContent property
  • Loading branch information
tugcekucukoglu authored May 31, 2022
2 parents 21a5a6a + 380345a commit dd9d3c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ function create(el) {

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

if (el.$_ptooltipFitContent) {
container.style.width = 'fit-content';
}

return container;
}

Expand Down Expand Up @@ -293,12 +297,14 @@ const Tooltip = {
target.$_ptooltipDisabled = false;
target.$_ptooltipEscape = false;
target.$_ptooltipClass = null;
target.$_ptooltipFitContent = true;
}
else {
target.$_ptooltipValue = options.value.value;
target.$_ptooltipDisabled = options.value.disabled || false;
target.$_ptooltipEscape = options.value.escape || false;
target.$_ptooltipClass = options.value.class;
target.$_ptooltipFitContent = options.value.fitContent || true;
}

target.$_ptooltipZIndex = options.instance.$primevue && options.instance.$primevue.config && options.instance.$primevue.config.zIndex.tooltip;
Expand Down
6 changes: 6 additions & 0 deletions src/views/tooltip/TooltipDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ directives: {
<td>true</td>
<td>By default the tooltip contents are rendered as text. Set to true to support html tags in the content.</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>
</tbody>
</table>
</div>
Expand Down

0 comments on commit dd9d3c8

Please sign in to comment.