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

Vue Components ​

Every component the Vue kit copies into your app, with its props, slots and events, and the injection keys it reads. Paths are relative to the kit's directory, resources/js/components/storyfeed by default.

vue
<FeedStream :page="feed" rail="actor" @load-more="loadOlder" />

Attributes not listed below, such as class and style, land on the component's root element.

The Feed ​

FeedStream ​

FeedStream.vue: a page of the feed, with day headings, each node, and a "Load older activity" button while there is a next cursor.

PropDefaultAccepts
pageany page shape as JSON
itemsthe nodes to draw, in place of page
next-cursorthe next page's cursor when you pass items; null at the end of the feed
loading-morefalsetrue disables the button and shows "Loading…"
groupedtruefalse hides the day headings
railnulla rail name or { primary, secondary }; null draws actor-only
child-railthe rail for expanded group members; unset inherits the group's
interactivetruefalse draws groups without a disclosure control
collapsednullthe initial group state; see Group State
dividers{}labels keyed by item id, drawn on the rail before those items
divider-style'branch'how a divider meets the rail: branch or dot
SlotReceivesReplaces
emptythe "No activity yet." text
body{ node }nothing; added under each row's meta line, before its bodies
annotations{ node }nothing; added at the end of each row
time{ node, label }each row's timestamp
EventPayloadFires
load-morenonewhen the reader asks for older activity

The body, annotations and time slots reach activities, groups and expanded group members.

vue
<FeedStream :items="items" :next-cursor="nextCursor"
    :loading-more="loading" @load-more="loadOlder">
    <template #time="{ node, label }">
        <a :href="`/activity/${node.id}`">{{ label }}</a>
    </template>
</FeedStream>

FeedNode ​

FeedNode.vue: one node. It draws FeedItem or FeedGroup, whichever the node is.

PropDefaultAccepts
iteman activity or group node
is-lastfalsetrue ends the rail at this row
railnulla rail
child-railthe rail for a group's expanded members
interactivetruefalse draws a group without a disclosure control
collapsednulla group's initial state
SlotReceivesReplaces
body{ node }nothing; added before the bodies
annotations{ node }nothing; added at the end of the row
time{ node, label }the timestamp

Rows ​

FeedItem ​

FeedItem.vue: an activity row.

PropDefaultAccepts
iteman activity node
densefalsetrue draws the compact row used for group members
is-lastfalsetrue ends the rail at this row
railnulla rail
SlotReceivesReplaces
body{ node }nothing; added before the bodies
annotations{ node }nothing; added at the end of the row
time{ node, label }the timestamp

FeedGroup ​

FeedGroup.vue: a group row, with its strip of member pictures and its members behind a disclosure.

PropDefaultAccepts
itema group node
is-lastfalsetrue ends the rail at this row
railnulla rail
child-railthe rail for expanded members
interactivetruefalse draws no disclosure control
collapsednullthe initial state
SlotReceivesReplaces
body{ node }nothing; added under the meta line, for the group and each member
annotations{ node }nothing; added at the end of the group and each member
time{ node, label }the group's and each member's timestamp

FeedHeadline ​

FeedHeadline.vue: a headline, each entity in it linked.

PropDefaultAccepts
templatethe node's headline_template, or null
headlinethe node's headline, drawn when there is no template
entitiesthe node's singular role slots
samplea group's sample
distincta group's distinct counts
counta group's member count
verbthe node's verb, drawn when there is neither
aggregatetrue for a group

FeedMeta ​

FeedMeta.vue: the line under a headline: the time, a time range and the roles the headline does not name.

PropDefaultAccepts
nodean activity or group node
templatesthe headline templates the row draws, to tell which roles they name
SlotReceivesReplaces
defaultthe timestamp

The Rail ​

FeedIcon ​

FeedIcon.vue: the activity's icon, in a disc or as a badge. Edit its icon map to draw your glyph tokens.

PropDefaultAccepts
iconthe node's glyph token
intentnullthe node's glyph_intent, written to data-sf-intent
variant'disc'disc or badge

EntityAvatar ​

EntityAvatar.vue: an entity's face: its media.icon, else its initials on its colour.

PropDefaultAccepts
entityan entity, or null for a blank disc
size'md'md, sm, badge, tile or pair

EntityLink.vue: an entity's label, linked through FEED_LINK when it has a link.

PropDefaultAccepts
entityan entity, or null
fallbackthe text drawn when the entity is null

Pictures ​

FeedMedia ​

FeedMedia.vue: one picture, its box reserved from its declared width and height. With FEED_MEDIA provided, that component draws it instead.

PropDefaultAccepts
image{ src, alt, width, height }
hrefa link around the picture
link-attributesattributes for that link; href and event handlers are dropped

FeedMediaStrip ​

FeedMediaStrip.vue: a group's strip: one square tile per member, then a "+N" tile.

PropDefaultAccepts
tilestiles from strip() in shared/strip.ts, or your own { image, href } objects
overflowthe "+N" count
toggle{ expanded, controls, label }: the "+N" tile becomes a button
EventPayloadFires
togglenonewhen the reader clicks the "+N" button

Bodies ​

Each built-in body type has a component in body/. The kit draws the body with the component registered for its type in FEED_BODIES, else its own. A type with neither draws its $fallback line, or nothing.

Body TypeComponent
Storyfeed/Body/CallToActionbody/CallToAction.vue
Storyfeed/Body/Componentbody/ComponentBody.vue
Storyfeed/Body/Excerptbody/Excerpt.vue
Storyfeed/Body/FileAttachment, Storyfeed/Body/Filebody/FileAttachment.vue
Storyfeed/Body/Imagebody/Image.vue
Storyfeed/Body/ItemListbody/ItemList.vue
Storyfeed/Body/KeyValuebody/KeyValue.vue
Storyfeed/Body/MediaObjectbody/MediaObject.vue
Storyfeed/Body/Prosebody/Prose.vue
Storyfeed/Body/Tablebody/Table.vue

Every body component, and every renderer in FEED_BODIES, receives these props. A component declares the ones it reads.

Body PropHolds
payloadthe body as it appears in the payload
entity-labelthe label of the entity that carries the body
entity-urlthat entity's link URL
entity-linkthat entity's link: { href, modal, attributes }
entity-mediathat entity's media

MediaObject ​

PropDefaultAccepts
payloadthe body
entity-labelthe entity's label
entity-urlthe entity's link URL
entity-linkthe entity's link
entity-mediathe entity's media
image-placementbeside or below the text; unset reads FEED_MEDIA_OBJECT_PLACEMENT, then beside

Injection Keys ​

Import the keys from keys.ts and provide() them in a page or layout, or app-wide with app.provide().

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>
SeamValueDefault
FEED_LINKa component that takes href, such as Inertia's Link; receives the entity's attributes and, for a modal CallToAction, modal'a'
FEED_BODIES{ [type]: Component }, body type to renderer; one registered for a built-in type replaces the kit's{}
FEED_COMPONENTS{ [name]: Component }, Component body name to component; receives the body's props{}
FEED_MEDIAa component that receives image, href and link-attributes, and draws every picturenone
FEED_FILE_LABELLER({ name, mediaType }) => string | null; null uses the built-in MIME labelsnone
FEED_MEDIA_OBJECT_PLACEMENT'beside' or 'below''beside'
FEED_NOWa timestamp in milliseconds that pins the clockthe browser's clock

feedBodies() ​

body/index.ts exports feedBodies(), a plugin that installs renderers in FEED_BODIES app-wide. Each install merges into the renderers already installed.

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

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

Words ​

shared/messages.ts holds the role words after the time, "Yesterday", and "from" and "until" for time ranges. The other words, such as "Show all" and "Load older activity", are in the components' templates.

Released under the MIT License.