ListWidget
Widget showing a list of elements.
A widget showing a list of elements. Pass the widget to Script.setWidget() display it on your Home Screen.
Be aware that the widget will refresh periodically and the rate at which the widget refreshes is largely determined by the operating system.
Also note that there are memory limitations when running a script in a widget. When using too much memory the widget will crash and not render correctly.
Properties
Section titled “Properties”addAccessoryWidgetBackground
Section titled “addAccessoryWidgetBackground”Whether to use an accessory widget background.
addAccessoryWidgetBackground: boolEnable to add an adaptive background that provides a standard appearance based on the widget’s environment. Defaults to false.
This is only available starting from iOS 16.
backgroundColor
Section titled “backgroundColor”Background color of the widget.
backgroundColor: ColorDefaults to a solid color in widgets placed on the Home Screen and a transparent color placed on the Lock Screen.
backgroundGradient
Section titled “backgroundGradient”Background gradient.
backgroundGradient: LinearGradientbackgroundImage
Section titled “backgroundImage”Background image.
backgroundImage: ImagebackgroundStyle
Section titled “backgroundStyle”Background style of the widget.
backgroundStyle: stringSet to "transparent" to reveal the wallpaper on the Home Screen. Requires iOS or iPadOS 27.2 or newer. iOS may apply its own outline or glass effect depending on the Home Screen appearance.
Defaults to "default", which uses the configured background color, image and gradient. The transparent style replaces those backgrounds on supported Home Screen widgets.
refreshAfterDate
Section titled “refreshAfterDate”Earliest date to refresh the widget.
refreshAfterDate: DateThe property indicates when the widget can be refreshed again. The widget will not be refreshed before the date have been reached. It is not guaranteed that the widget will refresh at exactly the specified date.
The refresh rate of a widget is partly up to iOS/iPadOS. For example, a widget may not refresh if the device is low on battery or the user is rarely looking at the widget.
When the property is null the default refresh interval is used. Defaults to null.
spacing
Section titled “spacing”Spacing between elements.
spacing: numberSpecifies the spacing between elements in the widget. You can also use the addSpacer() function on the widget to add spacing between elements. Defaults to 0.
URL to open.
url: stringThe URL will be opened when the widget is tapped. This will override any behavior defined in the configuration of the widget. E.g. if the widget is configured to run the script when interacting with the widget but a URL is set the URL will take precedence.
Methods
Section titled “Methods”
new ListWidget()
Section titled “new ListWidget()”Constructs a new list widget.
new ListWidget()A widget showing a list of elements. Pass the widget to Script.setWidget() to display it on your Home Screen.
addDate(date)
Section titled “addDate(date)”Add date to the widget.
addDate(date: Date): WidgetDateAdds a date element to the widget. Use the properties on the returned element to style the date.
Parameters
Section titled “Parameters”date Date
Return value
Section titled “Return value”WidgetDate
Date element.
addImage(image)
Section titled “addImage(image)”Add image to the widget.
addImage(image: Image): WidgetImageAdds an image element to the widget. Use the properties on the returned element to style the image.
Parameters
Section titled “Parameters”image Image
Return value
Section titled “Return value”WidgetImage
Image element.
addSpacer(length)
Section titled “addSpacer(length)”Add spacer.
addSpacer(length: number): WidgetSpacerAdds a spacer to the widget. This can be used to offset the content vertically in the widget.
Parameters
Section titled “Parameters”length number
Length of the spacer. Pass null to create a spacer with a flexible length.
Return value
Section titled “Return value”WidgetSpacer
Spacer element.
addStack()
Section titled “addStack()”Add stack.
addStack(): WidgetStackAdds a stack to the widget. Stacks layout elements horizontally by default.
Return value
Section titled “Return value”WidgetStack
Stack element.
addProgress(value, options)
Section titled “addProgress(value, options)”Add a progress indicator to the widget.
addProgress(value: number, options: dictionary?): WidgetStackAdds a progress indicator with a value from 0 to 100. Values outside that range are clamped. Use the returned stack to size the indicator or add content centered on top of it.
Parameters
Section titled “Parameters”value number
Progress from 0 to 100.
options dictionary?
Optional dictionary with style (“circular” or “linear”), progressColor, trackColor, and thickness in points. The default style is circular. Thickness sets the ring stroke or the initial height of a linear bar.
Return value
Section titled “Return value”WidgetStack
A stack sized to 40 by 40 points for a ring or 120 points wide for a bar.
addButton(title, options)
Section titled “addButton(title, options)”Add a button that runs a widget action.
addButton(title: string, options: {[key: string]: string})Tapping the button runs the configured script in the widget and reloads the widget. Read args.widgetAction.id to handle the action. Interactive controls require iOS or iPadOS 17 or later and a widget family that supports them.
Parameters
Section titled “Parameters”title string
The label shown on the control.
options {[key: string]: string}
A dictionary with a non-empty string id.
addRefreshButton(title)
Section titled “addRefreshButton(title)”Add a button that refreshes the widget.
addRefreshButton(title: string)Tapping the button reloads the widget and runs its normal render. The render receives no widget action. Interactive controls require iOS or iPadOS 17 or later and a widget family that supports them.
Parameters
Section titled “Parameters”title string
The label shown on the control.
addToggle(title, isOn, options)
Section titled “addToggle(title, isOn, options)”Add a toggle that runs a widget action.
addToggle(title: string, isOn: boolean, options: {[key: string]: string})Read args.widgetAction.isOn to get the requested state. Save the state before the script finishes and read it when rendering the widget again. Interactive controls require iOS or iPadOS 17 or later and a widget family that supports them.
Parameters
Section titled “Parameters”title string
The label shown on the control.
isOn boolean
The current saved state of the toggle.
options {[key: string]: string}
A dictionary with a non-empty string id.
addText(text)
Section titled “addText(text)”Add text to the widget.
addText(text: string): WidgetTextAdds a text element to the widget. Use the properties on the returned element to style the text.
Parameters
Section titled “Parameters”text string
Return value
Section titled “Return value”WidgetText
Text element.
presentAccessoryCircular()
Section titled “presentAccessoryCircular()”Presents a preview of the widget.
presentAccessoryCircular(): PromiseThe widget is presented in its circular accessory size that suitable to be displayed above the clock on the Lock Screen.
The preview is an estimated representation of the widget and is not accurate. Widgets placed on the Lock Screen change appearance based on the wallpaper and tint color of the Lock Screen, and as such, they cannot be previewed accurately in Scriptable.
Widgets on the Lock Screen are updated periodically so while working on your widget you may want to preview it in the app.
The circular accessory widget is available on iPhones running iOS 16 and newer.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
presentAccessoryInline()
Section titled “presentAccessoryInline()”Presents a preview of the widget.
presentAccessoryInline(): PromiseThe widget is presented in its accessory inline size that suitable to be displayed above the clock on the Lock Screen.
The preview is an estimated representation of the widget and is not accurate. Widgets placed on the Lock Screen change appearance based on the wallpaper and tint color of the Lock Screen, and as such, they cannot be previewed accurately in Scriptable.
Widgets on the Lock Screen are updated periodically so while working on your widget you may want to preview it in the app.
The accessory inline widget is available on iPhones running iOS 16 and newer and can display a single image and a single text. Any additional elements will be filtered away during presentation.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
presentAccessoryRectangular()
Section titled “presentAccessoryRectangular()”Presents a preview of the widget.
presentAccessoryRectangular(): PromiseThe widget is presented in its rectangular accessory size that suitable to be displayed above the clock on the Lock Screen.
The preview is an estimated representation of the widget and is not accurate. Widgets placed on the Lock Screen change appearance based on the wallpaper and tint color of the Lock Screen, and as such, they cannot be previewed accurately in Scriptable.
Widgets on the Lock Screen are updated periodically so while working on your widget you may want to preview it in the app.
The rectangular accessory widget is available on iPhones running iOS 16 and newer.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
presentExtraLarge()
Section titled “presentExtraLarge()”Presents a preview of the widget.
presentExtraLarge(): PromiseThe widget is presented in its extra large size.
Widgets on the Home Screen are updated periodically so while working on your widget you may want to preview it in the app.
The extra large widget is available on iPads running iOS 15 and newer.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
presentExtraLargePortrait()
Section titled “presentExtraLargePortrait()”Presents a portrait extra large widget preview.
presentExtraLargePortrait(): PromiseThis preview is available on iOS 27 and newer when the device and display setting have a measured size.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
presentLarge()
Section titled “presentLarge()”Presents a preview of the widget.
presentLarge(): PromiseThe widget is presented in its large size.
Widgets on the Home Screen are updated periodically so while working on your widget you may want to preview it in the app.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
presentMedium()
Section titled “presentMedium()”Presents a preview of the widget.
presentMedium(): PromiseThe widget is presented in its medium size.
Widgets on the Home Screen are updated periodically so while working on your widget you may want to preview it in the app.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
presentSmall()
Section titled “presentSmall()”Presents a preview of the widget.
presentSmall(): PromiseThe widget is presented in its small size.
Widgets on the Home Screen are updated periodically so while working on your widget you may want to preview it in the app.
Return value
Section titled “Return value”Promise
Promise that is fulfilled when the preview is dismissed.
setPadding(top, leading, bottom, trailing)
Section titled “setPadding(top, leading, bottom, trailing)”Set padding.
setPadding(top: number, leading: number, bottom: number, trailing: number)Sets the padding on each side of the widget.
Parameters
Section titled “Parameters”top number
Padding on the top edge.
leading number
Padding on the leading edge.
bottom number
Padding on the bottom edge.
trailing number
Padding on the trailing edge.
useDefaultPadding()
Section titled “useDefaultPadding()”Use the default padding.
useDefaultPadding()Configure the widget to use the default padding. Any padding previously defined with setPadding() will be discarded.