← All components
Motion
ComponentsStory Card
Story Card
Give one insight the whole frame.
- Motion layer
- Implemented
- Kosh Pro · $15 once
Frame 1 of 3.
This year214daysYour longest streak yet.
onSettle has fired 0 times. The prop can only calm this component further. The switch at the top of the page and your system setting still apply.
Why it moves this way
A dashboard answers questions. A story makes one point at a time, and that constraint is what makes people read it. Everywhere else Kosh keeps motion short. Here the entrance is allowed its moment, because the frame is the event.
Use it
npx shadcn@latest add @kosh-pro/story-cardimport { StoryCard } from "@/kosh/story-card/story-card";
<StoryCard
data={[
{ id: "streak", kicker: "This year", value: 214, unit: "days",
caption: "Your longest streak yet." },
{ id: "best-day", kicker: "Most often", value: "Tuesday",
caption: "is when you show up." },
]}
autoAdvance={5000}
/>Story Card is part of Kosh Pro. Your license key unlocks the @kosh-pro registry, which installs it with the motion core it needs. Set up the Pro registry ↗ Get Kosh Pro ↗
At each motion level
full- The kicker fades in, then the value rises 24 px and grows from 94% on a spring, then the caption fades in. The frame it replaces leaves in 150 ms. With autoAdvance, the current progress segment fills and its end advances the story.
reduced- Frames cross-fade with no travel. Auto-advance is off: the reader taps.
none- Frames swap at once. Auto-advance is off. Progress segments are full or empty.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
data | { id, kicker?, value, unit?, caption, visual? }[] | required | The frames. One insight each: if a frame needs the word “and”, it is two frames. |
autoAdvance | number | none | Milliseconds per frame. Only runs at full motion. Unset means tap only. |
aspect | "9:16" | "4:5" | "1:1" | "4:5" | The card's shape, reserved with aspect-ratio. |
onFrameChange | (index: number) => void | none | Called when the frame changes. |
exportable | boolean | true | Shows the Save image button. |
label | string | "Story" | The accessible name. |
| Prop | Type | Default | What it does |
|---|---|---|---|
motion | "auto" | "full" | "reduced" | "none" | "auto" | Motion for this component only. The calmest of this prop, the provider and the operating system wins. |
tone | "ink" | "signal" | "muted" | "ink" | Which colour carries the data. |
onSettle | () => void | none | Called once the component has come to rest after an update. |
className | string | none | Added to the root element. |
Theme with CSS variables on any ancestor: --k-story-bg, --k-story-ink, --k-story-muted.
Accessibility
- Auto-advance has a visible Pause button, and also pauses under the pointer and under keyboard focus.
- Left and right arrow keys change frame from anywhere in the card. Back and Next are real buttons. Tapping the left third or the rest of the frame does the same for touch and mouse.
- Frame changes are announced politely as “Frame 2 of 3” and the frame's text, except while it is playing by itself.
Limits and differences
- The saved image contains the kicker, value and caption. A frame's visual is not drawn into it: that needs an HTML-to-image library, loaded on demand.