The code samples below show how to use the StorytellerHome component in both Compose and Fragment. It includes a pull-to-refresh (PTR) mechanism, but you can also use the reloadData method to refresh data on your side.
Defaults: If theme is not provided, the global theme set via Storyteller.theme will be used. If uiStyle is not provided, it defaults to StorytellerListViewStyle.AUTO, which follows the system's light/dark mode setting.
context - optional context data that will be included in analytics callbacks for attribution. This allows you to track which sources drive engagement with your home content. See Analytics for more details.
// without reload data outside sdkStorytellerHome(homeId="home",theme=yourTheme,uiStyle=StorytellerListViewStyle.AUTO,context=mapOf("placementId"to"home_screen","location"to"Home"),modifier=Modifier)// with reload data outside sdkvalstate=rememberStorytellerHomeState()StorytellerHome(homeId="home",theme=yourTheme,uiStyle=StorytellerListViewStyle.AUTO,context=mapOf("placementId"to"home_screen","location"to"Home"),// Optional analytics contextstate=state,modifier=Modifier)// ...// call for reload data outside sdksuspendfunreloadData(){state.reloadData()}
valfragment=StorytellerHomeFragment.create(homeId="home",context=mapOf("placementId"to"home_screen","location"to"Home"),// Optional analytics context// theme = yourTheme, // Optional: Defaults to Storyteller.theme// uiStyle = StorytellerListViewStyle.AUTO, // Optional: Defaults to AUTO)// call for reload data outside sdkfragment.reloadData()
{"slug": "storyteller-home", "page_title": "Storyteller Home", "page_url": "StorytellerHome/", "canonical_url": "/android/StorytellerHome/", "markdown": "# Storyteller Home\n\n`StorytellerHome` is a component which allows multiple Stories and Clips Rows or Grids to be embedded in a single screen in your application in a list.\n\n## How to Use\n\nThe code samples below show how to use the `StorytellerHome` component in both `Compose` and `Fragment`. It includes a pull-to-refresh (PTR) mechanism, but you can also use the `reloadData` method to refresh data on your side.\n\n*Defaults: If `theme` is not provided, the global theme set via `Storyteller.theme` will be used. If `uiStyle` is not provided, it defaults to `StorytellerListViewStyle.AUTO`, which follows the system's light/dark mode setting.*\n\n`context` - optional context data that will be included in analytics callbacks for attribution. This allows you to track which sources drive engagement with your home content. See [Analytics](Analytics.md#context) for more details.\n\n### Compose\n\n```kotlin\n// without reload data outside sdk\nStorytellerHome(\n homeId = \"home\",\n theme = yourTheme,\n uiStyle = StorytellerListViewStyle.AUTO,\n context = mapOf(\"placementId\" to \"home_screen\", \"location\" to \"Home\"),\n modifier = Modifier\n)\n\n// with reload data outside sdk\nval state = rememberStorytellerHomeState()\n\nStorytellerHome (\n homeId = \"home\",\n theme = yourTheme,\n uiStyle = StorytellerListViewStyle.AUTO,\n context = mapOf(\"placementId\" to \"home_screen\", \"location\" to \"Home\"), // Optional analytics context\n state = state,\n modifier = Modifier\n)\n\n// ...\n\n// call for reload data outside sdk\nsuspend fun reloadData() {\n state.reloadData()\n}\n```\n\n### Fragment\n\n```kotlin\nval fragment = StorytellerHomeFragment.create(\n homeId = \"home\",\n context = mapOf(\"placementId\" to \"home_screen\", \"location\" to \"Home\"), // Optional analytics context\n // theme = yourTheme, // Optional: Defaults to Storyteller.theme\n // uiStyle = StorytellerListViewStyle.AUTO, // Optional: Defaults to AUTO\n )\n\n// call for reload data outside sdk\nfragment.reloadData()\n```\n", "copy_markdown_include_header": false, "base_path": "android", "ai_dir": "ai", "missing_payload_behavior": "empty"}