Example
Revenue, with a chart
A chart image alongside native text.
{
"v": 1,
"preferredFamily": "systemMedium",
"refresh": 1800,
"accessibility": "Revenue today 8,240 pounds, up 12 percent on yesterday",
"url": "https://dashboard.example.com/revenue",
"view": {
"type": "vstack",
"align": "leading",
"spacing": 0,
"padding": 14,
"bg": "#12141C",
"children": [
{
"type": "text",
"text": "REVENUE TODAY",
"style": "caption2",
"weight": "bold",
"color": "#6E7BA8"
},
{
"type": "hstack",
"spacing": 8,
"align": "center",
"children": [
{
"type": "text",
"text": "£8,240",
"style": "largeTitle",
"weight": "bold",
"design": "rounded",
"color": "white"
},
{
"type": "hstack",
"spacing": 2,
"padding": {"top": 3, "bottom": 3, "leading": 6, "trailing": 7},
"bg": "mint/20",
"corner": 8,
"children": [
{
"type": "symbol",
"name": "arrow.up.right",
"style": "caption",
"weight": "bold",
"color": "mint"
},
{
"type": "text",
"text": "12%",
"style": "subheadline",
"weight": "semibold",
"color": "mint"
}
]
}
]
},
{"type": "spacer"},
{
"type": "image",
"url": "https://webhookwidget.com/img/sparkline.png",
"fit": "fill",
"h": 46,
"tint": "mint"
}
]
}
} How it works
Use an image node for a chart or other graphic that is difficult to build from nodes. Keep the labels near it as text, so they support Dynamic Type and VoiceOver.
Use this in place of bitmap mode. A widget returned as one PNG has no live timers, no Dynamic Type, no automatic light and dark, and no legible tinted rendering. With a chart image inside a JSON view, the rest of the widget keeps all four.
fit sets how the image fills its box. fit keeps the whole image visible. fill covers the box and crops the image. An image stretches to the space it gets, so set its height and let the column set its width.
The change against yesterday is a pill: a symbol and a text in an hstack with a mint/20 background. One background on the stack covers both.
Put it on your Home Screen
We serve this example at the URL below. The server generates the timestamps at the time of each request. Add the URL as a hook in the app, and the widget works on your phone.
https://webhookwidget.com/demo/revenue Next
Support queue: A support queue with the oldest ticket highlighted.
All examples