0.42.2 • Published 27 days ago

@spectrum-web-components/tooltip v0.42.2

Weekly downloads
376
License
Apache-2.0
Repository
github
Last release
27 days ago

Description

sp-tooltip allow users to get contextual help or information about specific components when hovering or focusing on them.

Usage

See it on NPM! How big is this package in your project? Try it on webcomponents.dev

yarn add @spectrum-web-components/tooltip

Import the side effectful registration of <sp-tooltip> via:

import '@spectrum-web-components/tooltip/sp-tooltip.js';

When looking to leverage the Tooltip base class as a type and/or for extension purposes, do so via:

import { Tooltip } from '@spectrum-web-components/tooltip';

Example

Tooltips can be top, bottom, left, or right.

<sp-tooltip open placement="top">Label</sp-tooltip>
<br />
<br />
<sp-tooltip open placement="bottom">Label</sp-tooltip>
<br />
<br />
<sp-tooltip open placement="left">Label</sp-tooltip>
<br />
<br />
<sp-tooltip open placement="right">Label</sp-tooltip>

Self-managed overlays

By default, Tooltip provides styling without behavior. You must combine it with an Overlay Trigger in order to manage its overlay behavior.

You can use the tooltip as the descendant of an interactive element, such as Action Button, by applying the self-managed attribute which automatically binds the Tooltip to its first interactive ancestor element's focus/hover interactions:

<sp-action-button>
    Trigger
    <sp-tooltip self-managed>Content</sp-tooltip>
</sp-action-button>

This is especially useful when inserting an intermediate <overlay-trigger> would interfere with parent/child relationships, such as between <sp-action-group> and <sp-action-button>.

Note that an interactive element is an element that can receive focus during tab navigation, such as sp-action-button, sp-action-menu, sp-field-label etc.

Given that tooltip is not focusable by itself, it would not show up during tab navigation. Thus a tooltip would not be accessible if used with a non-interactive element, such as <sp-icon-*>.

The correct way to make it accessible would be to wrap it under an interactive element, such as sp-action-button:

<sp-action-button size="s">
    <sp-icon-info slot="icon"></sp-icon-info>
    <sp-tooltip self-managed placement="right">
        Display something here
    </sp-tooltip>
</sp-action-button>

Variants

Informative

This is the informative or info variant of Tooltip

<sp-tooltip open placement="top" variant="info">Label</sp-tooltip>
<sp-tooltip open placement="top" variant="info">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit
</sp-tooltip>
<sp-tooltip open placement="top" variant="info">
    <sp-icon-info slot="icon" size="s"></sp-icon-info>
    Label
</sp-tooltip>
<sp-tooltip open placement="top" variant="info">
    <sp-icon-info slot="icon" size="s"></sp-icon-info>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit
</sp-tooltip>

Positive

This is the postive (a.k.a.) success variant of Tooltip

<sp-tooltip open placement="top" variant="positive">Label</sp-tooltip>
<sp-tooltip open placement="top" variant="positive">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit
</sp-tooltip>
<sp-tooltip open placement="top" variant="positive">
    <sp-icon-checkmark-circle slot="icon" size="s"></sp-icon-checkmark-circle>
    Label
</sp-tooltip>
<sp-tooltip open placement="top" variant="positive">
    <sp-icon-checkmark-circle slot="icon" size="s"></sp-icon-checkmark-circle>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit
</sp-tooltip>

Negative

This is the negative a.k.a. error variant of Tooltip

<sp-tooltip open placement="top" variant="negative">Label</sp-tooltip>
<sp-tooltip open placement="top" variant="negative">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit
</sp-tooltip>
<sp-tooltip open placement="top" variant="negative">
    <sp-icon-alert slot="icon" size="s"></sp-icon-alert>
    Label
</sp-tooltip>
<sp-tooltip open placement="top" variant="negative">
    <sp-icon-alert slot="icon" size="s"></sp-icon-alert>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit
</sp-tooltip>
0.42.2

27 days ago

0.42.1

28 days ago

0.42.0

1 month ago

0.41.2

2 months ago

0.41.1

2 months ago

0.41.0

3 months ago

0.40.5

3 months ago

0.40.4

3 months ago

0.40.3

4 months ago

0.40.2

4 months ago

0.40.1

5 months ago

0.35.1-rc.15

9 months ago

0.35.1-rc.25

9 months ago

0.35.1-rc.26

9 months ago

0.35.1-rc.24

9 months ago

0.38.0

8 months ago

0.35.1-rc.34

9 months ago

0.35.1-rc.43

9 months ago

0.35.1-rc.41

9 months ago

0.39.1

7 months ago

0.39.0

7 months ago

0.39.4

6 months ago

0.39.3

6 months ago

0.39.2

7 months ago

0.36.0

9 months ago

0.40.0

6 months ago

0.37.0

9 months ago

0.34.1-rc.0

10 months ago

0.34.0

10 months ago

0.35.0

9 months ago

0.33.3-overlay.66

10 months ago

0.33.3-overlay.61

10 months ago

0.32.0

11 months ago

0.31.1-react.3

12 months ago

0.31.1-react.2

12 months ago

0.33.2

11 months ago

0.33.0

11 months ago

0.30.0

12 months ago

0.33.1-overlay.41

11 months ago

0.32.1-overlay.33

11 months ago

0.32.1-overlay.41

11 months ago

0.31.0

12 months ago

0.31.1-overlay.29

12 months ago

0.31.1-react.21

11 months ago

0.30.1-overlay.30

12 months ago

0.30.1-overlay.31

12 months ago

0.30.1-overlay.38

12 months ago

0.30.1-overlay.37

12 months ago

0.30.1-overlay.41

12 months ago

0.30.1-overlay.42

12 months ago

0.30.1-overlay.40

12 months ago

0.11.15

1 year ago

0.11.16

1 year ago

0.11.17

1 year ago

0.11.14

1 year ago

0.11.13

1 year ago

0.11.12

1 year ago

0.11.9

1 year ago

0.11.10

1 year ago

0.11.9-react.54

1 year ago

0.11.11

1 year ago

0.11.8

1 year ago

0.11.4

2 years ago

0.11.5

2 years ago

0.11.6

2 years ago

0.11.7

1 year ago

0.11.1

2 years ago

0.11.2

2 years ago

0.11.3

2 years ago

0.11.0

2 years ago

0.10.15

2 years ago

0.10.16

2 years ago

0.10.17

2 years ago

0.11.0-devmode.0

2 years ago

0.10.14-slim.2

2 years ago

0.10.14

2 years ago

0.10.12

2 years ago

0.10.13

2 years ago

0.10.11

2 years ago

0.10.10

2 years ago

0.11.0-slim.10

2 years ago

0.10.10-slim.10

2 years ago

0.10.9

2 years ago

0.10.7

2 years ago

0.10.8

2 years ago

0.10.8-express.0

2 years ago

0.10.2

2 years ago

0.10.3

2 years ago

0.10.4

2 years ago

0.10.5

2 years ago

0.10.6

2 years ago

0.10.3-express.0

2 years ago

0.10.7-express.9

2 years ago

0.10.1

2 years ago

0.10.0

2 years ago

0.10.2-express.0

2 years ago

0.9.1

2 years ago

0.9.1-lit-next.0

2 years ago

0.9.0

2 years ago

0.8.18

3 years ago

0.8.17

3 years ago

0.8.16

3 years ago

0.8.15

3 years ago

0.8.15-beta.3

3 years ago

0.8.15-alpha.1

3 years ago

0.8.14

3 years ago

0.8.14-alpha.1

3 years ago

0.8.13

3 years ago

0.8.13-alpha.1

3 years ago

0.8.12

3 years ago

0.8.11

3 years ago

0.8.12-alpha.1

3 years ago

0.8.11-alpha.1

3 years ago

0.8.10

3 years ago

0.8.10-alpha.14

3 years ago

0.8.10-alpha.13

3 years ago

0.8.10-alpha.12

3 years ago

0.8.10-alpha.1

3 years ago

0.8.9

3 years ago

0.8.9-alpha.0

3 years ago

0.8.8

3 years ago

0.8.8-alpha.0

3 years ago

0.8.7

3 years ago

0.8.6

3 years ago

0.8.6-alpha.1

3 years ago

0.8.6-alpha.0

3 years ago

0.8.5

3 years ago

0.8.5-alpha.26

3 years ago

0.8.5-alpha.23

3 years ago

0.8.5-alpha.21

3 years ago

0.8.5-alpha.11

3 years ago

0.8.5-alpha.12

3 years ago

0.8.5-alpha.10

3 years ago

0.8.5-beta.17

3 years ago

0.8.5-beta.15

3 years ago

0.8.5-beta.16

3 years ago

0.8.5-beta.13

3 years ago

0.8.5-beta.14

3 years ago

0.8.5-beta.11

3 years ago

0.8.5-beta.12

3 years ago

0.8.5-beta.10

3 years ago

0.8.5-alpha.17

3 years ago

0.8.5-alpha.9

3 years ago

0.8.4

3 years ago

0.8.3

3 years ago

0.8.2

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.3-alpha.33

3 years ago

0.7.3

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.5.5-alpha.178

3 years ago

0.6.0-alpha.40

3 years ago

0.6.0

3 years ago

0.5.5-alpha.169

3 years ago

0.5.5-alpha.84

3 years ago

0.5.5-alpha.85

3 years ago

0.5.5-alpha.60

3 years ago

0.5.4

4 years ago

0.5.4-alpha.0

4 years ago

0.5.3

4 years ago

0.5.3-beta.17

4 years ago

0.5.3-alpha.17

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.1-alpha.23

4 years ago

0.5.0

4 years ago

0.4.6-alpha.44

4 years ago

0.4.6

4 years ago

0.4.6-alpha.1

4 years ago

0.4.5-alpha.0

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.11-alpha.38

4 years ago

0.3.10

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.7-alpha.0

4 years ago

0.3.7-alpha.1

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

5 years ago

0.1.0

5 years ago