Skip to content
Calm motion: animations on this site only fade, with no movement

Stories ​

Rings of people with new stories, and a viewer with a timer for each story

Shows short posts that people share for a day, at the top of a social app. A story is one picture with a caption.

Basic

Home Studio

Story 1 of 2

A microphone on a desk

Recording ep 42 today2 h

  • people is a list of people. Each person has an id, a name, an optional avatar and seen, and a list of stories. Each story has an id, an image, an alt text, and an optional caption and time.
  • A person with new stories has a solid ring in the accent color. A person whose stories are seen has a thin dashed ring. Screen readers hear "new" for new stories.
  • A ring opens the viewer in a modal. Each story shows for duration seconds (default 5), with a bar for each story on top. Then the next story shows, and after the last story of a person, the stories of the next person.
  • The Pause button stops the timer, so a reader can take the time they need. The ‹ and › buttons and the arrow keys move between the stories.
  • Each story that shows emits seen with the id of the person and the story. Use it to set seen on the person.
  • Change the words with labels or a label pack: title, new, previous, next, pause, play, and the functions open and progress.

Usage ​

ts
import { BlessStories } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
people*BlessStoryPerson[]—
durationnumber5seconds for each story
labelsPartial<{ title: string; open: (name: string) => string; new: string; previous: string; next: string; pause: string; play: string; progress: (n: number, total: number) => string; }>—

Events

NamePayloadDescription
seen[personId: string, storyId: string]

Released under the MIT License. Character names and artwork belong to their owners.