Preview
Web-view
2min
The web-view component allows the user to use an URL or pass raw HTML as the preview content.
Long-press on a widget
This example displays a preview after long-pressing the widget
See the full example on GitHub.
long-press-on-widget
1preview:
2 isCompact: false
3 children:
4 - type: component.web-view
5 options:
6 uri: https://www.google.com
7 isTrackingTransparencyRequired: true
8 height: 500
Long-press - onPress action
This example displays a preview after long-pressing the list-item on the widget.
This example displays a preview after long-pressing the list-item in the jig. It includes the web-view component as well as the go-to actions.
As you can see in the code snippet, the original list doesn't include the preview. Our onPress action allows us to use the preview that is included in the detail jig.
See the full example of web-longpress-onpress and web-detail on GitHub.
web-view-longpress-onPress
web-detail
1title: Activity detail
2type: jig.default
3
4header:
5 type: component.jig-header
6 options:
7 height: small
8 children:
9 type: component.image
10 options:
11 title: [email protected]
12 source:
13 uri: https://images.unsplash.com/photo-1603988363607-e1e4a66962c6?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Njl8fHNwb3J0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=900&q=60
14
15children:
16 - type: component.entity
17 options:
18 isCompact: true
19 children:
20 - type: component.entity-field
21 options:
22 label: Activity
23 value: [email protected]
24
25 - type: component.entity-field
26 options:
27 label: Location
28 value: [email protected]
29 - type: component.entity-field
30 options:
31 label: Time
32 value: [email protected]
33
34preview:
35 isCompact: true
36 actions:
37 - children:
38 - type: action.go-to
39 options:
40 title: Go To Action
41 linkTo: placeholder
42 - type: action.go-to
43 options:
44 title: Go to Danger
45 linkTo: placeholder
46 style:
47 isDanger: true
48 - type: action.go-to
49 options:
50 title: Go to Disabled
51 linkTo: placeholder
52 style:
53 isDisabled: true
54
55
56 children:
57 - type: component.web-view
58 options:
59 isTrackingTransparencyRequired: true
60 content: |
61 <html>
62 <head>
63 <meta name="viewport" content="width=device-width, initial-scale=1">
64 </head>
65 <body style="margin: 0; text-align: center;">
66 <h1 style="text-align: center;"> Activity detail</h1>
67 <p style="text-align: center;">Tap to see more!</p>
68 </body>
69 </html>
70
71 header:
72 type: component.jig-header
73 options:
74 height: medium
75 children:
76 type: component.image
77 options:
78 title: [email protected]
79 subtitle: [email protected]
80 source:
81 uri: https://images.unsplash.com/photo-1603988363607-e1e4a66962c6?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Njl8fHNwb3J0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=900&q=60