office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
27 lines • 1.86 kB
JavaScript
import * as tslib_1 from "tslib";
import * as React from 'react';
import { TooltipHost } from 'office-ui-fabric-react/lib/Tooltip';
import { getId } from 'office-ui-fabric-react/lib/Utilities';
var TooltipDisplayExample = /** @class */ (function (_super) {
tslib_1.__extends(TooltipDisplayExample, _super);
function TooltipDisplayExample() {
var _this = _super !== null && _super.apply(this, arguments) || this;
// Use getId() to ensure that the IDs are unique on the page.
// (It's also okay to use plain strings without getId() and manually ensure uniqueness.)
_this._host1Id = getId('tooltipHost1');
_this._host2Id = getId('tooltipHost2');
return _this;
}
TooltipDisplayExample.prototype.render = function () {
return (React.createElement("div", null,
React.createElement("p", null, "In some cases when TooltipHost is wrapping inline-block or inline elements the positioning of the Tooltip may be off so it is recommended to modify the display property of the TooltipHost as in the following example."),
React.createElement(TooltipHost, { content: "Incorrect positioning", id: this._host1Id, calloutProps: { gapSpace: 0 } },
React.createElement("button", { style: { fontSize: '2em' }, "aria-labelledby": this._host1Id }, "Hover Over Me")),
' ',
React.createElement(TooltipHost, { content: "Correct positioning", styles: { root: { display: 'inline-block' } }, id: this._host2Id, calloutProps: { gapSpace: 0 } },
React.createElement("button", { style: { fontSize: '2em' }, "aria-labelledby": this._host2Id }, "Hover Over Me"))));
};
return TooltipDisplayExample;
}(React.Component));
export { TooltipDisplayExample };
//# sourceMappingURL=Tooltip.Display.Example.js.map