Skip to main content

View as Markdown · AI documentation index

Function: newStory()

newStory(id, content, options?): Story

Defined in: packages/core/src/passages/story/fabric.ts:29

Creates a story passage from a props-first content callback.

Parameters​

id​

string

Unique identifier for the story

content​

StoryContent

Function returning the story's components

options?​

StoryOptions

Optional background and styling configuration

Returns​

Story

New Story instance, already registered with the Game

Remarks​

Fully supported and not scheduled for removal. New code is encouraged to use defineStory instead, which hands the content callback a toolbox of component builders so component objects never have to be written by hand.

Example​

newStory('intro', () => [
{ type: 'header', content: 'Chapter 1', props: { level: 1 } },
{ type: 'text', content: 'Your journey begins...' }
]);