Skip to content

Commit

Permalink
feat(tooltip): Add mixin to set max-width of rich tooltip.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 634870062
  • Loading branch information
material-web-copybara authored and Copybara-Service committed May 20, 2024
1 parent 2f5b899 commit 611917e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mdc-tooltip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ Mixin | Description
`show-transition($enter-duration)` | Sets the duration for the animation that shows the tooltip.
`exit-transition($exit-duration)` | Sets the duration for the animation that hides the tooltip.
`rich-max-height($max-height)` | Sets the max-height of a rich tooltip.
`rich-max-width($max-width)` | Sets the max-width of a rich tooltip.

### `MDCTooltip` Methods

Expand Down
19 changes: 19 additions & 0 deletions packages/mdc-tooltip/_tooltip-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,25 @@ $z-index: 9;
}
}

// Sets the max-width of the rich tooltip.
// @param {Number} $max-width
@mixin rich-max-width($max-width, $query: feature-targeting.all()) {
$feat-structure: feature-targeting.create-target($query, structure);

&.mdc-tooltip--rich {
.mdc-tooltip__surface {
@include feature-targeting.targets($feat-structure) {
@include theme.property(max-width, $max-width);
}
.mdc-tooltip__content {
@include feature-targeting.targets($feat-structure) {
@include theme.property(max-width, $max-width);
}
}
}
}
}

// Sets the z-index of the tooltip.
// @param {Number} $z-index
@mixin z-index($z-index, $query: feature-targeting.all()) {
Expand Down

0 comments on commit 611917e

Please sign in to comment.