Skip to content

Commit 6ad8907

Browse files
committed
docs(api): update docs and examples with hideOnOutsideClick
1 parent 06a0c2d commit 6ad8907

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

README.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ yarn add -D @svelte-plugins/tooltips
1212
# or with NPM
1313

1414
npm i -D @svelte-plugins/tooltips
15+
16+
# or with PNPM
17+
18+
pnpm i -D @svelte-plugins/tooltips
1519
```
1620

1721
## Using the Tooltip component
@@ -40,25 +44,26 @@ Checkout out my <u use:tooltip={{ content: 'Hello World!' }}>tooltip</u>
4044
## API
4145

4246
### Props
43-
| Prop | Description | Value |
44-
| :----------- | :------------------------------------------------------------------ | :---------------------------------------------- |
45-
| action | The action that triggers the tooltip (hover | click | prop) | `string` (default: `hover`) |
46-
| animation | The animation to apply to the tooltip | `string` (default: ``) |
47-
| delay | The animation delay in milliseconds to apply to the tooltip | `number` (default: `200`) |
48-
| arrow | If `false`, the tooltip arrow will not be shown. | `boolean` (default: `true`) |
49-
| autoPosition | Adjust tooltip position if viewport clipping occurs | `string` (default: `false`) |
50-
| content | The string or object containing componentref and props | `string` | `object` component (default: ``) |
51-
| maxWidth | The max allowable width of the tooltip content | `number` (default: `200`) |
52-
| position | The position where the tooltip should appear relative to its parent | `string` (default: `top`) |
53-
| theme | The CSS theme class name | `string` (default: ``) |
54-
| show | Allows you to manually control the tooltip visibility | `boolean` (default: `false`) |
55-
| style | The object containing theme variable overrides | `object` (default: `null`) |
47+
| Prop | Description | Value |
48+
| :----------------- | :------------------------------------------------------------------ | :---------------------------------------------- |
49+
| action | The action that triggers the tooltip (hover | click | prop) | `string` (default: `hover`) |
50+
| animation | The animation to apply to the tooltip | `string` (default: ``) |
51+
| arrow | If `false`, the tooltip arrow will not be shown. | `boolean` (default: `true`) |
52+
| autoPosition | Adjust tooltip position if viewport clipping occurs | `boolean` (default: `false`) |
53+
| content | The string or object containing componentref and props | `string` | `object` component (default: ``) |
54+
| delay | The animation delay in milliseconds to apply to the tooltip | `number` (default: `200`) |
55+
| hideOnOutsideClick | Hides a tooltip when an outside click occurs | `boolean` (default: `false`) |
56+
| maxWidth | The max allowable width of the tooltip content | `number` (default: `200`) |
57+
| position | The position where the tooltip should appear relative to its parent | `string` (default: `top`) |
58+
| show | Allows you to manually control the tooltip visibility | `boolean` (default: `false`) |
59+
| style | The object containing theme variable overrides | `object` (default: `null`) |
60+
| theme | The CSS theme class name | `string` (default: ``) |
5661

5762
#### Using components as content
58-
| Prop | Description | Value |
59-
| :-----------------| :------------------------------------------------------------- | :---------------------------------- |
60-
| content.component | Svelte component | `component` (default: `null`) |
61-
| content.props | Any component propeties | `object` (default: `null`) |
63+
| Prop | Description | Value |
64+
| :-----------------| :------------------------------------------------------------------- | :---------------------------------------------- |
65+
| content.component | Svelte component | `component` (default: `null`) |
66+
| content.props | Any component propeties | `object` (default: `null`) |
6267

6368

6469
```svelte

docs/src/App.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</div>
3030

3131
<div class="example">
32-
<p>This tooltip should appear to the <b use:tooltip={{ content: 'Whoa! I appear to the right.', action: 'click', position: 'right', theme: 'tooltip-theme' }}>right</b> when clicked.</p>
32+
<p>This tooltip should appear to the <b use:tooltip={{ content: 'Whoa! I appear to the right.', hideOnClickOutside: true, action: 'click', position: 'right', theme: 'tooltip-theme' }}>right</b> when clicked.</p>
3333

3434
<Prism code={"<b use:tooltip={{ content: 'Whoa! I appear to the right.', position: 'right', action: 'click', theme: 'tooltip-theme' }}>right</b>"} />
3535

@@ -124,6 +124,7 @@
124124
content="Whoa! I appear to the right."
125125
position="right"
126126
action="click"
127+
hideOnClickOutside
127128
theme="tooltip-theme">
128129
<b>right</b>
129130
</Tooltip>
@@ -134,6 +135,7 @@
134135
content="Whoa! I appear to the right."
135136
position="right"
136137
action="click"
138+
hideOnClickOutside
137139
theme="tooltip-theme">
138140
<b>right</b>
139141
</Tooltip>

0 commit comments

Comments
 (0)