> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackfront.digital/llms.txt
> Use this file to discover all available pages before exploring further.

# Stories

# Stories

The SDK provides story/collection highlights similar to Instagram Stories. Stories are managed through the Stackfront REST API and support view tracking, tap tracking, and poll voting.

## Usage

```tsx theme={null}
import { useStories } from 'react-native-stackfront-sdk';

function StoryHighlights() {
  const { stories, loading, recordView, recordTap, recordPollVote } = useStories();

  if (loading) return <Loading />;

  const groups = stories?.groups ?? [];

  return (
    <StoryCarousel>
      {groups.map((group) => (
        <StoryGroup
          key={group.id}
          group={group}
          onStoryView={(storyId) => recordView(storyId, group.id, true)}
          onElementTap={(storyId, elementId) => recordTap(storyId, elementId, true)}
          onPollVote={(storyId, elementId, optionId) =>
            recordPollVote(storyId, elementId, optionId)
          }
        />
      ))}
    </StoryCarousel>
  );
}
```

## Hook API

```ts theme={null}
function useStories(): {
  stories: SdkStoriesResponse | null;
  loading: boolean;
  error: Error | null;
  refetch: () => Promise<void>;
  recordView: (storyId: string, storyGroupId: string, watchedFullDuration: boolean) => Promise<void>;
  recordTap: (storyId: string, elementId: string, actionTaken: boolean) => Promise<void>;
  recordPollVote: (storyId: string, elementId: string, optionId: string) => Promise<StoryPollVoteResponse>;
}
```

## Service API

```ts theme={null}
const { stories } = useStackfront();

await stories.getStories();
await stories.recordView({ storyId, storyGroupId, watchedFullDuration, oneSignalPlayerId });
await stories.recordTap({ storyId, elementId, actionTaken, oneSignalPlayerId });
await stories.recordPollVote({ storyId, elementId, optionId, oneSignalPlayerId });
```
