A grid shows Story or Clip tiles in columns. Use StorytellerStoriesGridView
for Stories and StorytellerClipsGridView for Clips. Set the number of columns
with the lists.grid.columnstheme property. To show a grid
only when it has content, check
getStoriesCount or
getClipsCount first.
conststoryGrid=newStoryteller.StorytellerStoriesGridView('stories-grid-id');// All CategoriesconststoryGridWithCategories=newStoryteller.StorytellerStoriesGridView('stories-grid-id',['category-1','category-2']);
Grids accept every setting in
Configure views. Grids don't use
cellType. TypeScript examples assume
import * as Storyteller from '@getstoryteller/storyteller-sdk-javascript';
and import type { IListConfiguration } from '@getstoryteller/storyteller-sdk-javascript';.
constcustomTheme=newStoryteller.UiTheme();// See Customize themesconstclipsGrid=newStoryteller.StorytellerClipsGridView('clips-grid-id','collection-id');clipsGrid.configuration={displayLimit:10,theme:customTheme,uiStyle:Storyteller.UiStyle.dark,};
constcustomTheme=newStoryteller.UiTheme();// See Customize themesconstclipsGrid=newStoryteller.StorytellerClipsGridView('clips-grid-id','collection-id');constclipsGridConfiguration:IListConfiguration<'StorytellerClipsGridView'>={displayLimit:10,theme:customTheme,uiStyle:Storyteller.UiStyle.dark,};clipsGrid.configuration=clipsGridConfiguration;
For Clips, the Storyteller Web Showcase's
StorytellerClipsGridView
sets the collection ID and display limit with the same configuration object.
{"slug": "storyteller-grid-view", "page_title": "Add a Story or Clips Grid", "page_url": "StorytellerGridView/", "canonical_url": "/web/StorytellerGridView/", "markdown": "# Add a Story or Clips grid {#configuring-a-storytellergridview}\n\nA grid shows Story or Clip tiles in columns. Use `StorytellerStoriesGridView`\nfor Stories and `StorytellerClipsGridView` for Clips. Set the number of columns\nwith the `lists.grid.columns` [theme property](Themes.md#lists). To show a grid\nonly when it has content, check\n[`getStoriesCount`](AdditionalMethods.md#getstoriescount) or\n[`getClipsCount`](AdditionalMethods.md#getclipscount) first.\n\n## Initialization\n\nCreate the grid with the ID of an existing element on your page. Grids take the\nsame arguments as the other views in\n[Configure views](StorytellerListView.md#initialization):\n\n### Stories initialization\n\n```javascript\nconst storyGrid = new Storyteller.StorytellerStoriesGridView('stories-grid-id'); // All Categories\nconst storyGridWithCategories = new Storyteller.StorytellerStoriesGridView(\n 'stories-grid-id',\n ['category-1', 'category-2']\n);\n```\n\n### Clips initialization\n\n```javascript\nconst clipsGrid = new Storyteller.StorytellerClipsGridView(\n 'clips-grid-id',\n 'clip-collection-id'\n);\n```\n\n## Configuration\n\nGrids accept every setting in\n[Configure views](StorytellerListView.md#configuration). Grids don't use\n`cellType`. TypeScript examples assume\n`import * as Storyteller from '@getstoryteller/storyteller-sdk-javascript';`\nand `import type { IListConfiguration } from '@getstoryteller/storyteller-sdk-javascript';`.\n\n### Stories configuration\n\n=== \"JavaScript\"\n\n ```javascript\n const customTheme = new Storyteller.UiTheme(); // See Customize themes\n const storyGrid = new Storyteller.StorytellerStoriesGridView('stories-grid-id');\n storyGrid.configuration = {\n categories: ['category1', 'category2', 'category3'], // Stories only\n displayLimit: 10,\n preload: true, // Stories only\n theme: customTheme,\n uiStyle: Storyteller.UiStyle.dark,\n };\n ```\n\n=== \"TypeScript\"\n\n ```typescript\n const customTheme = new Storyteller.UiTheme(); // See Customize themes\n const storyGrid = new Storyteller.StorytellerStoriesGridView('stories-grid-id');\n const storyGridConfiguration: IListConfiguration<'StorytellerStoriesGridView'> =\n {\n categories: ['category1', 'category2', 'category3'], // Stories only\n displayLimit: 10,\n preload: true, // Stories only\n theme: customTheme,\n uiStyle: Storyteller.UiStyle.dark,\n };\n storyGrid.configuration = storyGridConfiguration;\n ```\n\nFor a live example, review the Storyteller Web Showcase's\n[`StorytellerStoriesGridView`](https://github.com/getstoryteller/storyteller-showcase-web/blob/11.0.0/nextjs/src/components/atoms/StorytellerRenderers/StorytellerStoriesGridView.tsx#L60),\nwhich sets `basename`, `displayLimit`, and custom themes.\n\n### Clips configuration\n\n=== \"JavaScript\"\n\n ```javascript\n const customTheme = new Storyteller.UiTheme(); // See Customize themes\n const clipsGrid = new Storyteller.StorytellerClipsGridView(\n 'clips-grid-id',\n 'collection-id'\n );\n clipsGrid.configuration = {\n displayLimit: 10,\n theme: customTheme,\n uiStyle: Storyteller.UiStyle.dark,\n };\n ```\n\n=== \"TypeScript\"\n\n ```typescript\n const customTheme = new Storyteller.UiTheme(); // See Customize themes\n const clipsGrid = new Storyteller.StorytellerClipsGridView(\n 'clips-grid-id',\n 'collection-id'\n );\n const clipsGridConfiguration: IListConfiguration<'StorytellerClipsGridView'> = {\n displayLimit: 10,\n theme: customTheme,\n uiStyle: Storyteller.UiStyle.dark,\n };\n clipsGrid.configuration = clipsGridConfiguration;\n ```\n\nFor Clips, the Storyteller Web Showcase's\n[`StorytellerClipsGridView`](https://github.com/getstoryteller/storyteller-showcase-web/blob/11.0.0/nextjs/src/components/atoms/StorytellerRenderers/StorytellerClipsGridView.tsx#L52-L61)\nsets the collection ID and display limit with the same `configuration` object.\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}