---
title: ListWidget
description: Widget showing a list of elements.
---

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

### addAccessoryWidgetBackground

Whether to use an accessory widget background.

```typescript
addAccessoryWidgetBackground: bool
```

Enable 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

Background color of the widget.

```typescript
backgroundColor: Color
```

Defaults to a solid color in widgets placed on the Home Screen and a transparent color placed on the Lock Screen.

### backgroundGradient

Background gradient.

```typescript
backgroundGradient: LinearGradient
```

### backgroundImage

Background image.

```typescript
backgroundImage: Image
```

### backgroundStyle

Background style of the widget.

```typescript
backgroundStyle: string
```

Set 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

Earliest date to refresh the widget.

```typescript
refreshAfterDate: Date
```

The 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

Spacing between elements.

```typescript
spacing: number
```

Specifies 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

URL to open.

```typescript
url: string
```

The 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

<span id="-new-listwidget" class="api-anchor"></span>

### new ListWidget()

Constructs a new list widget.

```typescript
new ListWidget()
```

A widget showing a list of elements. Pass the widget to Script.setWidget() to display it on your Home Screen.

<span id="-adddate" class="api-anchor"></span>

### addDate(date)

Add date to the widget.

```typescript
addDate(date: Date): WidgetDate
```

Adds a date element to the widget. Use the properties on the returned element to style the date.

#### Parameters

**`date` `Date`**



#### Return value

**`WidgetDate`**

Date element.

<span id="-addimage" class="api-anchor"></span>

### addImage(image)

Add image to the widget.

```typescript
addImage(image: Image): WidgetImage
```

Adds an image element to the widget. Use the properties on the returned element to style the image.

#### Parameters

**`image` `Image`**



#### Return value

**`WidgetImage`**

Image element.

<span id="-addspacer" class="api-anchor"></span>

### addSpacer(length)

Add spacer.

```typescript
addSpacer(length: number): WidgetSpacer
```

Adds a spacer to the widget. This can be used to offset the content vertically in the widget.

#### Parameters

**`length` `number`**

Length of the spacer. Pass null to create a spacer with a flexible length.

#### Return value

**`WidgetSpacer`**

Spacer element.

<span id="-addstack" class="api-anchor"></span>

### addStack()

Add stack.

```typescript
addStack(): WidgetStack
```

Adds a stack to the widget. Stacks layout elements horizontally by default.

#### Return value

**`WidgetStack`**

Stack element.

<span id="-addprogress" class="api-anchor"></span>

### addProgress(value, options)

Add a progress indicator to the widget.

```typescript
addProgress(value: number, options: dictionary?): WidgetStack
```

Adds 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

**`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

**`WidgetStack`**

A stack sized to 40 by 40 points for a ring or 120 points wide for a bar.

<span id="-addbutton" class="api-anchor"></span>

### addButton(title, options)

Add a button that runs a widget action.

```typescript
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

**`title` `string`**

The label shown on the control.

**`options` `{[key: string]: string}`**

A dictionary with a non-empty string `id`.

<span id="-addrefreshbutton" class="api-anchor"></span>

### addRefreshButton(title)

Add a button that refreshes the widget.

```typescript
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

**`title` `string`**

The label shown on the control.

<span id="-addtoggle" class="api-anchor"></span>

### addToggle(title, isOn, options)

Add a toggle that runs a widget action.

```typescript
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

**`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`.

<span id="-addtext" class="api-anchor"></span>

### addText(text)

Add text to the widget.

```typescript
addText(text: string): WidgetText
```

Adds a text element to the widget. Use the properties on the returned element to style the text.

#### Parameters

**`text` `string`**



#### Return value

**`WidgetText`**

Text element.

<span id="-presentaccessorycircular" class="api-anchor"></span>

### presentAccessoryCircular()

Presents a preview of the widget.

```typescript
presentAccessoryCircular(): Promise
```

The 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

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-presentaccessoryinline" class="api-anchor"></span>

### presentAccessoryInline()

Presents a preview of the widget.

```typescript
presentAccessoryInline(): Promise
```

The 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

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-presentaccessoryrectangular" class="api-anchor"></span>

### presentAccessoryRectangular()

Presents a preview of the widget.

```typescript
presentAccessoryRectangular(): Promise
```

The 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

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-presentextralarge" class="api-anchor"></span>

### presentExtraLarge()

Presents a preview of the widget.

```typescript
presentExtraLarge(): Promise
```

The 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

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-presentextralargeportrait" class="api-anchor"></span>

### presentExtraLargePortrait()

Presents a portrait extra large widget preview.

```typescript
presentExtraLargePortrait(): Promise
```

This preview is available on iOS 27 and newer when the device and display setting have a measured size.

#### Return value

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-presentlarge" class="api-anchor"></span>

### presentLarge()

Presents a preview of the widget.

```typescript
presentLarge(): Promise
```

The 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

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-presentmedium" class="api-anchor"></span>

### presentMedium()

Presents a preview of the widget.

```typescript
presentMedium(): Promise
```

The 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

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-presentsmall" class="api-anchor"></span>

### presentSmall()

Presents a preview of the widget.

```typescript
presentSmall(): Promise
```

The 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

**`Promise`**

Promise that is fulfilled when the preview is dismissed.

<span id="-setpadding" class="api-anchor"></span>

### setPadding(top, leading, bottom, trailing)

Set padding.

```typescript
setPadding(top: number, leading: number, bottom: number, trailing: number)
```

Sets the padding on each side of the widget.

#### 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.

<span id="-usedefaultpadding" class="api-anchor"></span>

### useDefaultPadding()

Use the default padding.

```typescript
useDefaultPadding()
```

Configure the widget to use the default padding. Any padding previously defined with `setPadding()` will be discarded.