Examples
Every example is a complete widget. Download it and drop it on the Widgets section of your Library, or copy its files into your widgets folder. Then open its files and change things: that’s the fastest way to learn.
Big Clock
World Clock
Greeting
Countdown
Quotes
Battery Ring
Day, Month and Year
Weather Card
Now Playing Bar| Example | Shows how to |
|---|---|
| Big Clock | stack text, use the system font’s weights, follow the 24-hour option |
| World Clock | use JavaScript Intl for time zones, lay out two columns |
| Greeting | compute text in a script, read a text option |
| Countdown | do date math, validate option input |
| Quotes | rotate content on a schedule |
| Battery Ring | draw a progress ring with text inside |
| Day, Month and Year | draw progress bars with labels and percentages |
| Weather Card | build a card with a background shape and weather tokens |
| Now Playing Bar | hide a whole widget when there’s no data, tint an SVG icon |
The six built-in widgets are made in the same format, and are worth reading too.
