You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/customwidgets.mdx
+27-11Lines changed: 27 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ All widgets share a similar structure that roughly looks like the example below:
14
14
15
15
```json
16
16
"<widget name>": {
17
-
"icon": "<fontawesome icon name>",
17
+
"icon": "<font awesome icon name>",
18
18
"label": "<the text label of the widget>",
19
19
"color": "<the color of the label>",
20
20
"blockdef": {
@@ -29,20 +29,36 @@ All widgets share a similar structure that roughly looks like the example below:
29
29
30
30
This consists of a couple different parts. First and foremost, each widget has a unique identifying name. The value associated with this name is the outer `WidgetConfigType`. It is outlined in red below:
31
31
32
+

33
+
32
34
This `WidgetConfigType` is shared between all types of widgets. That is to say, all widgets—regardless of type— will use the same keys for this. The accepted keys are:
| "display:order" | (optional) Overrides the order of widgets with a number in case you want the widget to be different than the order provided in the `widgets.json` file. Defaults to 0. |
37
-
| "icon" | (optional) The name of a fontawesome icon. Defaults to `"browser"`.|
39
+
| "icon" | (optional) The name of a [font awesome icon](#font-awesome-icons). Defaults to `"browser"`. |
38
40
| "color" | (optional) A string representing a color as would be used in CSS. Hex codes and custom CSS properties are included. This defaults to `"var(--secondary-text-color)"` which is a color wave uses for text that should be differentiated from other text. Out of the box, it is `"#c3c8c2"`. |
39
41
| "label" | (optional) A string representing the label that appears underneath the widget. It will also act as a tooltip on hover if the `"description"` key isn't filled out. It is null by default. |
40
42
| "description" | (optional) A description of what the widget does. If it is specified, this serves as a tooltip on hover. It is null by default. |
41
43
| "blockdef" | This is where the the non-visual portion of the widget is defined. Note that all further definition takes place inside a meta object inside this one. |
42
44
43
-
The other options are part of the inner `MetaTSType`. This contains all of the details about how the widget actually works. The valid keys vary with each type of widget. They will be individually explored in more detail below.
45
+
<aname="font-awesome-icons" />
46
+
:::info
44
47
45
-

48
+
**Font Awesome Icons**
49
+
50
+
[Font Awesome](https://fontawesome.com/search) provides a ton of useful icons that you can use as a widget icon in your app. At it's simplest, you can just provide the icon name and it will be used. For example, the string `"house"`, will provide an icon containing a house. We also allow you to apply a few different styles to your icon by modifying the name as follows:
|<icon name>| The plain icon with no additional styles applied. |
55
+
| solid@<icon name>| Adds the `fa-solid` class to the icon to fill in the content with a fill color rather than leaving it a background. |
56
+
| regular@<icon name>| Adds the `fa-regular` class to the icon to ensure the content will not have a fill color and will use a standard outline instead. |
57
+
| brands@<icon name>| This is required to add the required `fa-brands` class to an icon associated with a brand. Without this, brand icons will not render properly. This will not work with icons that aren't brand icons. |
58
+
59
+
:::
60
+
61
+
The other options are part of the inner `MetaTSType` (outlined in blue in the image). This contains all of the details about how the widget actually works. The valid keys vary with each type of widget. They will be individually explored in more detail below.
46
62
47
63
# Terminal and CLI Widgets
48
64
@@ -52,7 +68,7 @@ A terminal widget, or CLI widget, is a widget that simply opens a terminal and r
52
68
{
53
69
<... other widgets go here ...>,
54
70
"<widget name>": {
55
-
"icon": "<fontawesome icon name>",
71
+
"icon": "<font awesome icon name>",
56
72
"label": "<the text label of the widget>",
57
73
"color": "<the color of the label>",
58
74
"blockdef": {
@@ -140,7 +156,7 @@ Sometimes, it is desireable to open a page directly to a website. That can easil
140
156
{
141
157
<... other widgets go here ...>,
142
158
"<widget name>": {
143
-
"icon": "<fontawesome icon name>",
159
+
"icon": "<font awesome icon name>",
144
160
"label": "<the text label of the widget>",
145
161
"color": "<the color of the label>",
146
162
"blockdef": {
@@ -211,8 +227,8 @@ The Sysinfo Widget is intentionally kept to a very small subset of possible valu
211
227
"blockdef": {
212
228
"meta": {
213
229
"view": "sysinfo",
214
-
"graph:numpoints": <the max number of points in the graph>,
215
-
"sysinfo:type": <the name of the plot collection>,
230
+
"graph:numpoints": <the max number of points in the graph>,
231
+
"sysinfo:type": <the name of the plot collection>,
216
232
}
217
233
}
218
234
},
@@ -238,8 +254,8 @@ Suppose you have a build process that lasts 3 minutes and you'd like to be able
238
254
"blockdef": {
239
255
"meta": {
240
256
"view": "sysinfo",
241
-
"graph:numpoints": 180,
242
-
"sysinfo:type": "CPU + Mem"
257
+
"graph:numpoints": 180,
258
+
"sysinfo:type": "CPU + Mem"
243
259
}
244
260
}
245
261
},
@@ -258,7 +274,7 @@ Now, suppose you are fine with the default 100 points (and 100 seconds) but woul
0 commit comments