-
-
Notifications
You must be signed in to change notification settings - Fork 281
Expand file tree
/
Copy path_Rich.svelte
More file actions
66 lines (61 loc) · 1.75 KB
/
Copy path_Rich.svelte
File metadata and controls
66 lines (61 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<div style="display: flex; flex-wrap: wrap; align-items: center;">
<!--
Note: the wrapper on a rich tooltip
creates a DOM element.
-->
<Wrapper rich>
<Button onclick={() => clicked++} touch>
<Label>Rich Tooltip</Label>
</Button>
<!--
Note: the toolip element in a rich
tooltip stays in place.
-->
<Tooltip>
<Content>
A rich tooltip can provide a lot more information than a regular toolip.
It is sized appropriately for a large amount of content.
</Content>
</Tooltip>
</Wrapper>
<Wrapper rich>
<Button onclick={() => clicked++} touch>
<Label>Interactive Rich Tooltip</Label>
</Button>
<Tooltip interactive>
<Title>With a Title!</Title>
<Content>
An interactive rich tooltip can have <Link
href="http://example.com"
target="_blank">links</Link
> and actions.
</Content>
<RichActions>
<Button onclick={() => clicked++}><Label>Action</Label></Button>
</RichActions>
</Tooltip>
</Wrapper>
<Wrapper rich>
<span role="button" tabindex="0">Persistent Rich Tooltip (Click Me)</span>
<Tooltip persistent>
<Title>With a Title!</Title>
<Content>
A persistent rich tooltip shows up when you click or press enter/space
bar on an element and goes away when you activate it again or it loses
focus. Great for informational popups on those little "i" icons.
</Content>
</Tooltip>
</Wrapper>
</div>
<pre class="status">Clicked: {clicked}</pre>
<script lang="ts">
import Tooltip, {
Wrapper,
Title,
Content,
Link,
RichActions,
} from '@smui/tooltip';
import Button, { Label } from '@smui/button';
let clicked = $state(0);
</script>