Contents

RepeatableImageFill

The object for adding a background image that Apple News can repeat.

Declaration

object RepeatableImageFill

Properties

NameTypeDescription
type Requiredstring

Always repeatable_image for this object.

URL Requireduri

The URL of the image file to use for filling the component.

Image URLs can begin with http://, https://, or bundle://. If the image URL begins with bundle://, the referenced image file must be in the same directory as the document.

Encode image filenames as URLs.

See Preparing Image, Video, Audio, Music, and ARKit Assets.

attachmentstring

A string that indicates how the fill behaves when someone scrolls.

Valid values:

  • scroll (default). The fill scrolls along with its component.

  • fixed. The fill stays at a fixed position within the viewport.

height(SupportedUnits | number)

The height of the image as it’s repeated. When you omit the height, Apple News uses the width property to determine the size based on the aspect ratio of the provided image.

horizontalAlignmentstring

A string that sets the horizontal alignment of the image fill within its component.

Valid values:

  • left. Aligns the left edge of the fill with the left edge of the component.

  • center (default). Aligns the horizontal center of the fill with the center of the component.

  • right. Aligns the right edge of the fill with the right edge of the component.

repeatstring

A string that defines the direction in which Apple News repeats the background image.

Valid values:

  • none. Apple News doesn’t repeat the background image.

  • x. Apple News repeats the image horizontally based on the original size of the image.

  • y. Apple News repeats the image vertically based on the original size of the image.

  • both (default). The image is repeated horizontally and vertically based on the original size of the image.

verticalAlignmentstring

The vertical alignment of the repeatable image fill within its component.

Valid values:

  • top. Aligns the top of the fill with the top edge of the component.

  • center (default). Aligns the vertical center of the fill with the center of the component.

  • bottom. Aligns the bottom of the fill with the bottom edge of the component.

This property has no effect when the repeat property is set to both or y.

width(SupportedUnits | number)

The width of the image as it’s repeated. When you omit width, Apple News uses the height property to determine the size based on the aspect ratio of the provided image.

Mentioned in

Discussion

Use the RepeatableImage fill type object to add a repeatable image on components.

The recommended dimensions for a repeatable image are as follows:

  • Minimum dimensions: 3 x 6 or 6 x 3 pixels

  • Maximum dimensions: 3000 x 3000 pixels

Example

{
  "components": [
    {
      "role": "container",
      "layout": {
        "minimumHeight": 300
      },
      "style": {
        "fill": {
          "type": "repeatable_image",
          "URL": "bundle://myimage.jpg",
          "repeat": "x",
          "width": 30,
          "height": 30,
          "verticalAlignment": "center"
        }
      }
    }
  ]
}

See Also

Backgrounds for Components