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

Customizing the Kits ​

The kits take their colours from your CSS variables and use your own components for links, bodies and pictures.

Colour Tokens ​

resources/css/app.css
css
@theme inline {
    --color-background: var(--background);
    --color-foreground: var(--foreground);
    --color-card: var(--card);
    --color-muted: var(--muted);
    --color-muted-foreground: var(--muted-foreground);
    --color-primary: var(--primary);
    --color-primary-foreground: var(--primary-foreground);
    --color-border: var(--border);
    --color-ring: var(--ring);
}

Laravel's Vue and React starter kits define these variables and their dark values. For another app, define them for :root and .dark in your palette. Use Tailwind v4's @custom-variant dark (&:where(.dark, .dark *)); when your layout selects dark mode with a class.

TokenUse
background, foregroundsurface and text
cardcard surface
muted, muted-foregroundsecondary surface and text
primary, primary-foregroundprimary colour and text on it
border, ringboundaries and focus rings

An avatar draws the entity's media.icon, else its media.initials on a media.color disc, else data.initials on data.avatar_color, else a colour from a stable identity palette. Deleted models render in the muted colour. An icon’s intent is rendered as data-sf-intent; style it in your CSS, for example [data-sf-intent="danger"].

Host Seams ​

resources/js/pages/History.vue
vue
<script setup lang="ts">
import { provide } from 'vue';
import { Link } from '@inertiajs/vue3';
import { FEED_LINK } from '@/components/storyfeed/keys';

provide(FEED_LINK, Link);
</script>
resources/js/pages/History.tsx
tsx
import { Link } from '@inertiajs/react';
import { FeedProvider, FeedStream } from '@/components/storyfeed';
import type { FeedPagePayload } from '@/components/storyfeed';
import Message from '@/components/feed/Message';

export default function History({ feed }: { feed: FeedPagePayload }) {
    return (
        <FeedProvider
            FEED_LINK={Link}
            FEED_COMPONENTS={{ 'App/Message': Message }}
        >
            <FeedStream page={feed} />
        </FeedProvider>
    );
}

Vue imports injection keys from keys.ts. React takes the same names as FeedProvider props. Nested React providers inherit surrounding options.

SeamValueBehaviour
FEED_LINKcomponent accepting hrefreplaces anchors and forwards entity attributes
FEED_COMPONENTSexact body-name → component maprenders Component bodies with their props; unknown names draw nothing
FEED_BODIESexact body-type → component mapdraws a body type, such as Acme/Shipment; one registered for a built-in type replaces the kit's
FEED_FILE_LABELLER({ name, mediaType }) => string | nullreturn a label, or null to use the built-in MIME labels
FEED_MEDIA_OBJECT_PLACEMENT'beside' or 'below'beside shows a MediaObject’s picture beside its text; below stacks it. An explicit component prop wins
FEED_NOWmillisecond timestamppins the clock for deterministic rendering
FEED_MEDIAmedia componentreplaces pictures and tiles, for example with a lightbox; receives the image, href, link attributes and kit classes

Vue’s MediaObject prop is image-placement; React’s is imagePlacement.

Built-in bodies render from the object’s bodies and data, and the activity’s data. Supply your own components for previews in other roles. Markdown and rich HTML are sanitized. Plain text and verbatim source are escaped.

Rendering Custom Body Types ​

In Vue, install renderers with the feedBodies() plugin. Each install merges into the renderers already installed:

resources/js/app.ts
ts
import { feedBodies } from '@/components/storyfeed/body';
import Shipment from '@/components/feed/Shipment.vue';

createApp(App).use(feedBodies({ 'Acme/Shipment': Shipment }));

The renderer receives payload, entityLabel, entityUrl and entityMedia props. To register renderers for one part of the page, provide() a map with the FEED_BODIES key.

In React, pass FEED_BODIES to FeedProvider. A renderer receives BodyProps; nested providers merge their maps:

resources/js/components/feed/Shipment.tsx
tsx
import type { BodyProps } from '@/components/storyfeed';

export default function Shipment({ payload }: BodyProps) {
    return <p>{payload.carrier} · {payload.tracking}</p>;
}
resources/js/pages/History.tsxHistory()
tsx
<FeedProvider FEED_BODIES={{ 'Acme/Shipment': Shipment }}>
    <FeedStream page={feed} />
</FeedProvider>

A body type with no renderer draws its $fallback line as muted text, or nothing without one. Blade draws a body type from a published view.

Roles After the Time ​

Roles the headline does not name appear after the time, each after a word:

RoleWord
instrumentvia
originfrom
resultto
locationat
generatorfrom

Context appears only when the headline names it. Vue and React keep the words in shared/messages.ts. Blade reads them from the storyfeed-ui::meta translation namespace; override them in lang/vendor/storyfeed-ui/{locale}/meta.php.

Rails and Groups ​

resources/js/pages/History.vuetemplate
vue
<FeedStream :page="feed" rail="actor" child-rail="activity-only"
    style="--sf-gutter: 2.5rem" />
resources/js/pages/History.tsxHistory()
tsx
<FeedStream page={feed} rail="actor" childRail="activity-only" />
resources/views/history.blade.php
blade
<x-storyfeed::feed :page="$page" rail="actor" child-rail="activity-only" />

The rail is the column of avatars and icons beside each row; child-rail sets it for expanded group members. Day headings, dividers and group state take attributes the same way.

Erica Sinclair
Erica Sinclair placed 3 orders with Scoops Ahoy
Tue 2 Jul, 12:20 PM
Tue 2 Jul, 12:15 PM
Tue 2 Jul, 12:10 PM

Pages, Rails and Styles shows every rail, divider style and group state. The component reference pages name each option in each kit.

The rail's width, its gap to the content and the disc and badge sizes are CSS variables.

Group Disclosure ​

Native details provides the disclosure and works without JavaScript. By default, groups without a headline open; with :interactive="false", every group opens. Static collapsed members remain in the HTML for printing.

The disclosure says “Show less” when open and “Show all 3” for a collapsed three-member group. A group shows its full member count even when the page holds fewer members. Expanding displays the supplied children; it does not fetch more: to page through every member, read them with members(). A collapsed group shows a strip of up to four member tiles, or three and a “+N” tile: a member's picture when its row draws one, else its featured entity's name. Expanding the group hides the strip.

Feed Size and Code Blocks ​

resources/views/history.blade.php
blade
<x-storyfeed::feed :page="$page" class="[--sf-font-size:0.875rem]" />

--sf-font-size scales text, spacing, avatars, badges and the rail together. Set it on the feed or on any element around it, in rem or px.

CSS PropertyControlsDefault
--sf-font-sizethe feed's body text size; every other size follows it1rem
--sf-prose-max-hthe height at which code and verbatim Prose scroll24rem
--sf-code-bg, --sf-code-fgthe background and text of verbatim Prosea dark surface with light text

Blade Host Seams ​

Blade supplies whole-feed callbacks through the renderers array to customize time, bodies, annotations, media and file labels.

CallbackReceivesReturns
time, body, annotationsFeedItemapp HTML
removedFeedItemremoval text
glyph, avatartoken/entity and sizeapp SVG or avatar HTML
fileLabel{name, mediaType} arraylabel or null for built-in MIME labels
form (a body)body array, owning entity or nullapp HTML, or null for built-in rendering
mediaTiles, mediaOverflowgroup FeedItemsample tiles or overflow count
mediatile array and utility classespicture or tile HTML
resources/views/history.blade.php
blade
<x-storyfeed::feed :page="$page" :renderers="[
    'fileLabel' => fn (array $file) => match ($file['mediaType']) {
        'application/vnd.apple.keynote' => 'Keynote',
        default => null,
    },
]" />

Callbacks are trusted application code; their returned HTML is not sanitized. Standalone row components also accept body, time and annotations slots. The standalone file component accepts labeller; <x-storyfeed::body> accepts file-labeller.

Blade Components, Vue Components, React Components and Pages, Rails and Styles list every component and option.

Released under the MIT License.