A view renders Storyteller content into a container element on your page. This page lists the constructor of each view class, the properties and methods that views share, and the configuration interfaces. For layout and setup tasks, see Choose a view and Configure views.
Clips collection ID. With an empty ID, the view loads no Clips
useGoogleWebStoryUrls
boolean
No
false
Accepted for parity with Stories views. It has no effect on Clips
The declarations also list a fourth argument, { deferInitialization?: boolean }. The SDK's player views use it to delay loading. Leave it out: with deferInitialization: true, a row or grid never loads.
RowView and GridView are deprecated aliases of StorytellerStoriesRowView and StorytellerStoriesGridView. They reference the same classes. Use the full names in new code.
The constructors read the container element when you call them:
The element must exist. Otherwise, the SDK logs No element with ID <elementId> was found. The Storyteller view couldn't be initialized. as a console error, and the view renders nothing
Use an ID with ASCII letters, numbers, -, and _. An ID that is not a valid CSS selector logs a warning when logging is enabled
The SDK adds the storyteller class and a storyteller-view-id attribute to the element
The element can also carry these attributes, which the constructor reads once:
ViewName is the class name, such as 'StorytellerStoriesRowView'. The two Clips player classes both use 'StorytellerClipsPlayerView', and their setter takes IStorytellerClipsPlayerConfiguration. ListConfiguration is not exported. Assign an IListConfiguration value instead.
Assigning an object updates only the fields that it includes:
A change to categories, collection, clipId, or externalId reloads the view's content
A change to theme or uiStyle rebuilds the view theme
A displayLimit field set to undefined or 0 removes the limit
A context change applies to later activity events
Reading the property returns the current values, including the view theme that the SDK merged from the global theme and configuration.theme.
The view's callbacks. The Clips player classes use IStorytellerClipsPlayerDelegate. Assigning an object replaces the previous delegate. The SDK fills callbacks that you leave out with no-op functions.
Loads fresh content for the view from the API. Clips views load the first page again. The view calls onDataLoadStarted, then onDataLoadComplete with the result.
Returns: a promise that resolves after the load finishes. A failed load resolves too and reports the error through onDataLoadComplete
Releases the view. The SDK unmounts the view from the container, removes the view's player container unless another view shares it, and stops theme updates for the view. A second call does nothing. Call destroy before your application removes or replaces the container, such as in a React effect cleanup.
Available on StorytellerClipsRowView. Sets the tile shape to CellType.round or CellType.square. The Clips row configuration has no cellType field, so use this setter or the data-cell-type attribute. For StorytellerStoriesRowView, use configuration.cellType.
Available on StorytellerClipsPlayerView and StorytellerEmbeddedClipsPlayerView. true shows a back button at the top of the player. A tap calls onTopLevelBackTapped, or window.history.back() when the delegate has no such callback. The default is false. This property is not part of configuration.
ListTypeToConfigMap is an internal map from each view class name to its fields. Pass a view class name as the type argument to select the fields for that view. Every field is optional:
Type argument
Fields
None
basename, context, displayLimit, theme, uiStyle
'StorytellerStoriesRowView'
The fields for no type argument, plus categories, preload, cellType
'StorytellerStoriesGridView'
The fields for no type argument, plus categories, preload
Both types have the same fields as IListConfiguration<'StorytellerClipsPlayerView'>: basename, context, displayLimit, theme, uiStyle, collection, clipId, and externalId. Their theme field also accepts a full IUiTheme.
An update that includes a source field changes the source. Include exactly one non-empty source field. Otherwise, the SDK logs an error and keeps the current source.
{"slug": "reference-views", "page_title": "Views and Configuration", "page_url": "reference/views/", "canonical_url": "/web/reference/views/", "markdown": "# Views and configuration\n\nA view renders Storyteller content into a container element on your page. This page lists the constructor of each view class, the properties and methods that views share, and the configuration interfaces. For layout and setup tasks, see [Choose a view](../views/index.md) and [Configure views](../StorytellerListView.md).\n\n## View classes\n\nThe SDK exports six view classes:\n\n| Class | Shows | Content argument | Configuration input | Delegate |\n| --- | --- | --- | --- | --- |\n| [`StorytellerStoriesRowView`](#storytellerstoriesrowview) | Stories in a horizontal row | Optional category IDs | `IListConfiguration<'StorytellerStoriesRowView'>` | `IListViewDelegate` |\n| [`StorytellerStoriesGridView`](#storytellerstoriesgridview) | Stories in a grid | Optional category IDs | `IListConfiguration<'StorytellerStoriesGridView'>` | `IListViewDelegate` |\n| [`StorytellerClipsRowView`](#storytellerclipsrowview) | Clips in a horizontal row | Collection ID | `IListConfiguration<'StorytellerClipsRowView'>` | `IListViewDelegate` |\n| [`StorytellerClipsGridView`](#storytellerclipsgridview) | Clips in a grid | Collection ID | `IListConfiguration<'StorytellerClipsGridView'>` | `IListViewDelegate` |\n| [`StorytellerClipsPlayerView`](#storytellerclipsplayerview) | A Clips player mounted in the page | Collection ID, `{ clipId }`, or `{ externalId }` | `IStorytellerClipsPlayerConfiguration` | `IStorytellerClipsPlayerDelegate` |\n| [`StorytellerEmbeddedClipsPlayerView`](#storytellerembeddedclipsplayerview) | A Clips player that fills a fixed area of the page | Collection ID, `{ clipId }`, or `{ externalId }` | `IStorytellerEmbeddedClipsPlayerConfiguration` | `IStorytellerClipsPlayerDelegate` |\n\nCreate a view after [`initialize`](storyteller.md#initialize) resolves, and call [`destroy`](#destroy) before your application removes the container.\n\n## Constructors\n\nEach constructor takes the container element ID first. The constructor renders the view and starts loading its content.\n\n### `StorytellerStoriesRowView`\n\n```typescript\nnew StorytellerStoriesRowView(\n elementId: string,\n listCategories?: string[],\n useGoogleWebStoryUrls?: boolean\n)\n```\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `elementId` | `string` | Yes | None | ID of the container element |\n| `listCategories` | `string[]` | No | `[]` | Story category IDs. With no categories, the row shows the Stories in the Home list |\n| `useGoogleWebStoryUrls` | `boolean` | No | `false` | `true` turns each Story tile into a link to the Story's Google Web Story URL, when the API provides one, instead of opening the SDK player |\n\n```typescript\nconst storyRow = new Storyteller.StorytellerStoriesRowView(\n 'stories-row-id',\n ['category-id']\n);\n```\n\n- **Guide**: [Add a Story or Clips row](../StorytellerRowView.md#stories-initialization)\n\n### `StorytellerStoriesGridView`\n\n```typescript\nnew StorytellerStoriesGridView(\n elementId: string,\n listCategories?: string[],\n useGoogleWebStoryUrls?: boolean\n)\n```\n\nThe parameters match [`StorytellerStoriesRowView`](#storytellerstoriesrowview).\n\n- **Guide**: [Add a Story or Clips grid](../StorytellerGridView.md#stories-initialization)\n\n### `StorytellerClipsRowView`\n\n```typescript\nnew StorytellerClipsRowView(\n elementId: string,\n collectionName: string,\n useGoogleWebStoryUrls?: boolean\n)\n```\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `elementId` | `string` | Yes | None | ID of the container element |\n| `collectionName` | `string` | Yes | None | Clips collection ID. With an empty ID, the view loads no Clips |\n| `useGoogleWebStoryUrls` | `boolean` | No | `false` | Accepted for parity with Stories views. It has no effect on Clips |\n\nThe declarations also list a fourth argument, `{ deferInitialization?: boolean }`. The SDK's player views use it to delay loading. Leave it out: with `deferInitialization: true`, a row or grid never loads.\n\n```typescript\nconst clipsRow = new Storyteller.StorytellerClipsRowView(\n 'clips-row-id',\n 'collection-id'\n);\n```\n\n- **Guide**: [Add a Story or Clips row](../StorytellerRowView.md#clips-initialization)\n\n### `StorytellerClipsGridView`\n\n```typescript\nnew StorytellerClipsGridView(\n elementId: string,\n collectionName: string,\n useGoogleWebStoryUrls?: boolean\n)\n```\n\nThe parameters match [`StorytellerClipsRowView`](#storytellerclipsrowview).\n\n- **Guide**: [Add a Story or Clips grid](../StorytellerGridView.md#clips-initialization)\n\n### `StorytellerClipsPlayerView`\n\n```typescript\nnew StorytellerClipsPlayerView(\n elementId: string,\n source: string | StorytellerClipsPlayerSource,\n useGoogleWebStoryUrls?: boolean\n)\n```\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `elementId` | `string` | Yes | None | ID of the container element |\n| `source` | `string` or `StorytellerClipsPlayerSource` | Yes | None | A collection ID string, or an object with exactly one of `collection`, `clipId`, or `externalId` |\n| `useGoogleWebStoryUrls` | `boolean` | No | `false` | Accepted for parity with Stories views. It has no effect on Clips |\n\n`StorytellerClipsPlayerSource` has three optional fields. Set exactly one of them to a non-empty value:\n\n```typescript\ninterface StorytellerClipsPlayerSource {\n collection?: string;\n clipId?: string;\n externalId?: string;\n}\n```\n\nA `collection` source plays the collection and supports collection navigation. A `clipId` or `externalId` source plays one Clip.\n\nThe constructor throws an `Error` for an object source with more than one value or with none:\n\n| Source | Error message |\n| --- | --- |\n| More than one non-empty field | ``StorytellerClipsPlayerView only supports one source at a time. Provide exactly one of `collection`, `clipId`, or `externalId`.`` |\n| No non-empty field | ``StorytellerClipsPlayerView requires one of `collection`, `clipId`, or `externalId`.`` |\n\n```typescript\nconst clipPlayer = new Storyteller.StorytellerClipsPlayerView(\n 'clips-player-id',\n { externalId: 'clip-external-id' }\n);\n```\n\n- **Since**: 10.1.0. Single-Clip sources were added in 10.13.6\n- **Guide**: [Clips player initialization](../StorytellerListView.md#clips-player-initialization)\n\n### `StorytellerEmbeddedClipsPlayerView`\n\n```typescript\nnew StorytellerEmbeddedClipsPlayerView(\n elementId: string,\n source: string | StorytellerClipsPlayerSource,\n useGoogleWebStoryUrls?: boolean\n)\n```\n\nThe class extends `StorytellerClipsPlayerView`, so its parameters, source rules, errors, and members match that class. It differs in these ways:\n\n- The player shows one Clip at a time and fills the container. Size the container with CSS\n- The player does not lock page scrolling. Wheel input over the player stays in the player instead of scrolling the page\n- [`Storyteller.sharedInstance.dismissPlayer`](storyteller.md#dismissplayer) does not close it\n\nThe embedded player suits a fixed area of your layout, such as a live blog or match centre.\n\n- **Since**: 10.13.7\n- **Guide**: [Add a Clips player to a page](../StorytellerEmbeddedClipsPlayerView.md#initialization)\n\n### Deprecated aliases\n\n`RowView` and `GridView` are deprecated aliases of `StorytellerStoriesRowView` and `StorytellerStoriesGridView`. They reference the same classes. Use the full names in new code.\n\n### Container element\n\nThe constructors read the container element when you call them:\n\n- The element must exist. Otherwise, the SDK logs `No element with ID <elementId> was found. The Storyteller view couldn't be initialized.` as a console error, and the view renders nothing\n- Use an ID with ASCII letters, numbers, `-`, and `_`. An ID that is not a valid CSS selector logs a warning when logging is enabled\n- The SDK adds the `storyteller` class and a `storyteller-view-id` attribute to the element\n\nThe element can also carry these attributes, which the constructor reads once:\n\n| Attribute | Values | Views | Effect |\n| --- | --- | --- | --- |\n| `data-ui-style` | `auto`, `light`, `dark` | All | Initial `uiStyle` |\n| `data-cell-type` | `round`, `square` | `StorytellerStoriesRowView`, `StorytellerClipsRowView` | Initial tile shape |\n| `data-base-url` | A basename | All | Basename to use when `configuration.basename` is not set |\n\nA row fills the height of its container, so give the container a height. See the note in [Add a Story or Clips row](../StorytellerRowView.md#clips-initialization).\n\n## Members of every view\n\nEvery view class has these members.\n\n### `configuration`\n\n```typescript\nset configuration(configuration: Partial<ListConfiguration<ViewName>>)\nget configuration(): ListConfiguration<ViewName>\n```\n\n`ViewName` is the class name, such as `'StorytellerStoriesRowView'`. The two Clips player classes both use `'StorytellerClipsPlayerView'`, and their setter takes `IStorytellerClipsPlayerConfiguration`. `ListConfiguration` is not exported. Assign an [`IListConfiguration`](#ilistconfiguration) value instead.\n\nAssigning an object updates only the fields that it includes:\n\n- A change to `categories`, `collection`, `clipId`, or `externalId` reloads the view's content\n- A change to `theme` or `uiStyle` rebuilds the view theme\n- A `displayLimit` field set to `undefined` or `0` removes the limit\n- A `context` change applies to later activity events\n\nReading the property returns the current values, including the view theme that the SDK merged from the global theme and `configuration.theme`.\n\n```typescript\nstoryRow.configuration = {\n categories: ['category-id'],\n displayLimit: 10,\n uiStyle: Storyteller.UiStyle.dark,\n};\n```\n\n- **Since**: 10.0.0\n- **Guide**: [Configure views](../StorytellerListView.md#configuration)\n\n### `delegate`\n\n```typescript\nget delegate(): IListViewDelegate\nset delegate(delegateObj: IListViewDelegate)\n```\n\nThe view's callbacks. The Clips player classes use [`IStorytellerClipsPlayerDelegate`](callbacks.md#istorytellerclipsplayerdelegate). Assigning an object replaces the previous delegate. The SDK fills callbacks that you leave out with no-op functions.\n\n```typescript\nstoryRow.delegate = {\n onDataLoadComplete: (success, error, dataCount) => {\n const container = document.getElementById('stories-row-id');\n\n if (container) {\n container.hidden = !success || dataCount === 0;\n }\n },\n};\n```\n\n- **Type**: [`IListViewDelegate`](callbacks.md#ilistviewdelegate)\n- **Guide**: [Handle view callbacks](../StorytellerListViewDelegate.md)\n\n### `reloadData`\n\n```typescript\nreloadData(): Promise<void>\n```\n\nLoads fresh content for the view from the API. Clips views load the first page again. The view calls `onDataLoadStarted`, then `onDataLoadComplete` with the result.\n\n- **Returns**: a promise that resolves after the load finishes. A failed load resolves too and reports the error through `onDataLoadComplete`\n- **Guide**: [reloadData](../StorytellerListView.md#reloaddata)\n\n### `destroy`\n\n```typescript\ndestroy(): void\n```\n\nReleases the view. The SDK unmounts the view from the container, removes the view's player container unless another view shares it, and stops theme updates for the view. A second call does nothing. Call `destroy` before your application removes or replaces the container, such as in a React effect cleanup.\n\n- **Guides**: [Use React or Next.js](../getting-started/react-nextjs.md#react), [Troubleshoot page transitions](../getting-started/troubleshooting.md#5-check-page-transitions)\n\n### Deprecated view members\n\nThese members still work in 11.0.0. Replace them with `configuration` or the shared instance:\n\n| Member | Views | Replacement |\n| --- | --- | --- |\n| `theme` (get and set) | All | `configuration.theme` |\n| `uiStyle` (get and set) | All | `configuration.uiStyle` |\n| `displayLimit` (get and set) | All | `configuration.displayLimit` |\n| `categories` (get and set) | Stories views | `configuration.categories`. The setter does not reload the view |\n| `cellType` (set) | `StorytellerStoriesRowView` | `configuration.cellType` |\n| `openStory(id: string): void` | Stories views | [`Storyteller.sharedInstance.openStory`](storyteller.md#openstory) |\n| `openPage(pageId: string, onError?: (message: string) => void): void` | Stories views | [`Storyteller.sharedInstance.openPage`](storyteller.md#openpage) |\n\n## Members of some views\n\nThese members exist only on the classes listed.\n\n### `cellType`\n\n```typescript\nset cellType(type: StorytellerListViewCellType)\n```\n\nAvailable on `StorytellerClipsRowView`. Sets the tile shape to [`CellType.round`](types.md#celltype) or `CellType.square`. The Clips row configuration has no `cellType` field, so use this setter or the `data-cell-type` attribute. For `StorytellerStoriesRowView`, use `configuration.cellType`.\n\n- **Guide**: [cellType](../StorytellerRowView.md#celltype)\n\n### `topLevelBackButtonEnabled`\n\n```typescript\nget topLevelBackButtonEnabled(): boolean\nset topLevelBackButtonEnabled(isEnabled: boolean)\n```\n\nAvailable on `StorytellerClipsPlayerView` and `StorytellerEmbeddedClipsPlayerView`. `true` shows a back button at the top of the player. A tap calls [`onTopLevelBackTapped`](callbacks.md#ontoplevelbacktapped), or `window.history.back()` when the delegate has no such callback. The default is `false`. This property is not part of `configuration`.\n\n```typescript\nclipPlayer.topLevelBackButtonEnabled = true;\nclipPlayer.delegate = {\n onTopLevelBackTapped: () => {\n window.history.back();\n },\n};\n```\n\n- **Since**: 10.13.6\n- **Guide**: [topLevelBackButtonEnabled](../StorytellerListView.md#toplevelbackbuttonenabled-clips-player-only)\n\n## Configuration\n\nThe configuration interfaces describe what you can assign to a view's `configuration` property.\n\n### `IListConfiguration`\n\n```typescript\ntype IListConfiguration<\n ListType extends keyof ListTypeToConfigMap | void = void\n>\n```\n\n`ListTypeToConfigMap` is an internal map from each view class name to its fields. Pass a view class name as the type argument to select the fields for that view. Every field is optional:\n\n| Type argument | Fields |\n| --- | --- |\n| None | `basename`, `context`, `displayLimit`, `theme`, `uiStyle` |\n| `'StorytellerStoriesRowView'` | The fields for no type argument, plus `categories`, `preload`, `cellType` |\n| `'StorytellerStoriesGridView'` | The fields for no type argument, plus `categories`, `preload` |\n| `'StorytellerClipsRowView'`, `'StorytellerClipsGridView'` | The fields for no type argument, plus `collection` |\n| `'StorytellerClipsPlayerView'`, `'StorytellerEmbeddedClipsPlayerView'` | The fields for no type argument, plus `collection`, `clipId`, `externalId` |\n\nThe fields have these types and defaults:\n\n| Field | Type | Views | Default | Description |\n| --- | --- | --- | --- | --- |\n| [`basename`](../StorytellerListView.md#basename) | `string` | All | `stories` or `clips`. With several views on a page, a value derived from the categories or collection | First segment of the player hash URL. The SDK keeps only ASCII letters, numbers, `-`, and `_` |\n| [`categories`](../StorytellerListView.md#categories-stories-only) | `string[]` | Stories views | The constructor `listCategories` | Story category IDs |\n| [`cellType`](../StorytellerRowView.md#celltype) | [`CellType`](types.md#celltype) | `StorytellerStoriesRowView` | `CellType.square`, or the `data-cell-type` attribute | Tile shape |\n| [`collection`](../StorytellerListView.md#collection-clips-only) | `string` | Clips views | The constructor collection | Clips collection ID |\n| [`clipId`](../StorytellerListView.md#clipid-externalid-clips-player-only) | `string` | Clips players | None | Clip ID for single-Clip playback |\n| [`externalId`](../StorytellerListView.md#clipid-externalid-clips-player-only) | `string` | Clips players | None | Clip external ID for single-Clip playback |\n| [`context`](../StorytellerListView.md#context) | `unknown` | All | `undefined` | Your attribution data. The SDK returns it in `UserActivityData.context` |\n| [`displayLimit`](../StorytellerListView.md#displaylimit) | `number` | Rows and grids. The player types accept it too | No limit | Maximum number of tiles |\n| [`preload`](../StorytellerListView.md#preload) | `boolean` | Stories views | `false` | `true` starts more Story player work before the first open. Assigning `false` later does not undo `true` |\n| [`theme`](../StorytellerListView.md#theme) | `Subset<UiTheme>` | All | The global theme | View theme. The SDK merges it over [`Storyteller.sharedInstance.theme`](storyteller.md#theme) |\n| [`uiStyle`](../StorytellerListView.md#uistyle) | [`UiStyle`](types.md#uistyle) | All | `UiStyle.auto`, or the `data-ui-style` attribute | Light, dark, or system color scheme |\n\n```typescript\ntype RowConfiguration =\n Storyteller.IListConfiguration<'StorytellerStoriesRowView'>;\n\nconst rowConfiguration: RowConfiguration = {\n basename: 'top-stories',\n cellType: Storyteller.CellType.round,\n context: { location: 'home' },\n};\n\nstoryRow.configuration = rowConfiguration;\n```\n\n- **Since**: 10.0.0. `context` was added in 10.13.17\n- **Guide**: [Configure views](../StorytellerListView.md#configuration)\n\n### Clips player configuration types\n\n```typescript\ntype IStorytellerClipsPlayerConfiguration =\n Partial<StorytellerClipsPlayerConfiguration>;\n\ntype IStorytellerEmbeddedClipsPlayerConfiguration =\n Partial<StorytellerClipsPlayerConfiguration>;\n```\n\nBoth types have the same fields as `IListConfiguration<'StorytellerClipsPlayerView'>`: `basename`, `context`, `displayLimit`, `theme`, `uiStyle`, `collection`, `clipId`, and `externalId`. Their `theme` field also accepts a full `IUiTheme`.\n\nAn update that includes a source field changes the source. Include exactly one non-empty source field. Otherwise, the SDK logs an error and keeps the current source.\n\n```typescript\nclipPlayer.configuration = {\n externalId: 'new-clip-external-id',\n};\n```\n\n- **Guides**: [Clips player configuration](../StorytellerListView.md#clips-player-configuration), [Embedded Clips player configuration](../StorytellerListView.md#embedded-clips-player-configuration)\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}