Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip: Custom className for the arrow element through props #1119

Merged
merged 3 commits into from Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/lib/Components/TooltipsPage.js
Expand Up @@ -51,6 +51,8 @@ export default class TooltipsPage extends React.Component {
className: PropTypes.string,
// Apply class to the inner-tooltip
innerClassName: PropTypes.string,
// Apply class to the arrow-tooltip ('arrow' by default)
arrowClassName: PropTypes.string,
// optionally hide tooltip when hovering over tooltip content - default true
autohide: PropTypes.bool,
// convenience attachments for popover
Expand Down
7 changes: 6 additions & 1 deletion src/PopperContent.js
Expand Up @@ -10,6 +10,7 @@ const propTypes = {
className: PropTypes.string,
placement: PropTypes.string,
placementPrefix: PropTypes.string,
arrowClassName: PropTypes.string,
hideArrow: PropTypes.bool,
tag: PropTypes.string,
isOpen: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -137,14 +138,18 @@ class PopperContent extends React.Component {
offset,
fallbackPlacement,
placementPrefix,
arrowClassName: _arrowClassName,
hideArrow,
className,
tag,
container,
modifiers,
...attrs
} = this.props;
const arrowClassName = mapToCssModules('arrow', cssModule);
const arrowClassName = mapToCssModules(classNames(
'arrow',
_arrowClassName
), cssModule);
const placement = (this.state.placement || attrs.placement).split('-')[0];
const popperClassName = mapToCssModules(classNames(
className,
Expand Down
2 changes: 2 additions & 0 deletions src/Tooltip.js
Expand Up @@ -21,6 +21,7 @@ const propTypes = {
hideArrow: PropTypes.bool,
className: PropTypes.string,
innerClassName: PropTypes.string,
arrowClassName: PropTypes.string,
cssModule: PropTypes.object,
toggle: PropTypes.func,
autohide: PropTypes.bool,
Expand Down Expand Up @@ -229,6 +230,7 @@ class Tooltip extends React.Component {
hideArrow={this.props.hideArrow}
placement={this.props.placement}
placementPrefix={this.props.placementPrefix}
arrowClassName={this.props.arrowClassName}
container={this.props.container}
modifiers={this.props.modifiers}
offset={this.props.offset}
Expand Down