React-tooltip: Tooltip reposition

Created on 23 Feb 2017  路  1Comment  路  Source: wwayne/react-tooltip

default position in my case - place: "right", offset: {top: -80, right: -40}

looks like:
2017-02-23 13 00 16

but when tooltip doesn't have enough space, he just reposition on top of target element:

2017-02-23 13 00 01 (target element is under the tooltip)

so offset is still {top: -80, right: -40}, but place: "top"

how can i position tooltip on the right of target element if not enough space for tooltip?

Most helpful comment

I had a similar issue and have not found a solution yet. This isn't really a bug just a missing potential feature. This feature should allow offset objects for each position. Example:

offsets={{
    top: {
        x: '-10px',
        y: '10px',
    },
    bottom: {
        y: '10px'
    },
    right: {
        x: '100px',
        y: '5px',
    }
}}

This is similar to what is implemented now except that instead of having a single offset object that applies to all positions, there would be one offset object per position. The reason I suggest here to use x and y is that it's more natural for CSS purposes since these positions are all relative to the top, left corner of the element anyways.

@wwayne any thoughts on this? It would be greatly beneficial for these edge cases where we build components that may or may not be placed on the edges of screens.

EDIT: I see there is already a PR that kinda does this already though not entirely.

>All comments

I had a similar issue and have not found a solution yet. This isn't really a bug just a missing potential feature. This feature should allow offset objects for each position. Example:

offsets={{
    top: {
        x: '-10px',
        y: '10px',
    },
    bottom: {
        y: '10px'
    },
    right: {
        x: '100px',
        y: '5px',
    }
}}

This is similar to what is implemented now except that instead of having a single offset object that applies to all positions, there would be one offset object per position. The reason I suggest here to use x and y is that it's more natural for CSS purposes since these positions are all relative to the top, left corner of the element anyways.

@wwayne any thoughts on this? It would be greatly beneficial for these edge cases where we build components that may or may not be placed on the edges of screens.

EDIT: I see there is already a PR that kinda does this already though not entirely.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

donilan picture donilan  路  4Comments

bonbonio picture bonbonio  路  4Comments

benbro picture benbro  路  3Comments

Ericky14 picture Ericky14  路  3Comments

Joseppi83 picture Joseppi83  路  4Comments