Pre-1.0. Not intended for public use yet. The API is subject to undocumented change, and these pages may already be wrong about it.

Skip to content

React ​

The React kit renders Storyfeed's serialized items with React 19 components. Copy it into your app, wrap the feed in FeedProvider, and pass a feed page to FeedStream.

bash
php artisan storyfeed:ui react
npm install react@^19 react-dom@^19 lucide-react micromark \
    micromark-extension-gfm-autolink-literal \
    micromark-extension-gfm-strikethrough \
    micromark-extension-gfm-table \
    micromark-extension-gfm-task-list-item \
    sanitize-html
npm install -D @types/react @types/react-dom @types/sanitize-html \
    @tailwindcss/typography
resources/js/pages/History.tsx
tsx
import { Link } from '@inertiajs/react';
import { FeedProvider, FeedStream } from '@/components/storyfeed';
import type { FeedPagePayload } from '@/components/storyfeed';

export default function History({ feed }: { feed: FeedPagePayload }) {
    return (
        <FeedProvider FEED_LINK={Link}>
            <FeedStream page={feed} />
        </FeedProvider>
    );
}
Erica Sinclair
Erica Sinclair placed 3 orders with Scoops Ahoy

page takes the JSON of a page from cursorPaginate() or simplePaginate(), which holds the items in data, or the plain array get() returns. It works with Inertia’s React adapter and Laravel’s React starter kit. The copied shared/ directory makes the imports self-contained. Configure Tailwind scanning and the Typography plugin.

Loading Older Activity ​

resources/js/pages/History.tsxHistory()
tsx
<FeedStream items={items} nextCursor={nextCursor}
    loadingMore={loading} onLoadMore={loadOlder} />

The app fetches the next page from next_cursor and appends its data to items. loadingMore disables the pager. Follow the feed's sync token. empty accepts a React node for an empty page.

Replacing Row Content ​

Render PropReceivesReplaces
body{ node }body content
annotations{ node }app annotations
time{ node, label }timestamp content; null omits time

These functions reach activities, groups and expanded children. Return null from time to omit the timestamp; the other metadata still renders. Nested providers inherit the outer options; explicit values win. See Host Seams.

Rails, day headings, dividers and group disclosure are set in Customizing the Kits.

Server Rendering ​

SSR and the first hydration render use ISO timestamps and UTC day keys. After mounting, labels use the browser's locale and calendar timezone. FEED_NOW pins the clock in milliseconds; otherwise relative labels refresh according to age.

React Components lists every component, prop, render prop and provider option.

Released under the MIT License.