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

Blade Components ​

Every component the Blade kit registers, with its attributes and slots. Each one is an anonymous component in the storyfeed:: namespace, so it renders on its own as well as inside <x-storyfeed::feed>.

blade
<x-storyfeed::feed :page="$page" rail="actor" />

Attributes not listed below, such as class, land on the component's root element. Pass a value that isn't a string with a colon: :grouped="false".

The Feed ​

<x-storyfeed::feed> ​

A page of the feed: day headings, each item, then a link to older activity.

AttributeDefaultAccepts
pagenullany page shape: a collection, a paginator, a FeedPage, or their JSON decoded as an array
itemsnullthe items to draw, in place of page
next-cursornullthe cursor for the pager when you pass items; a string or a Cursor
cursor-name'cursor'the query-string key the pager writes the cursor to
groupedtruefalse hides the day headings
railnulla rail; null draws actor-only
child-railnullthe rail for expanded group members; null inherits the group's
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
interactivetruefalse draws groups without a disclosure control
collapsednullthe initial group state; see Group State
timezonenullthe zone for day headings, timestamps and time ranges; null uses the app's
renderers[]renderer callbacks for every row and group member
SlotReplaces
emptythe "No activity yet." text on an empty page
footerthe pager
blade
<x-storyfeed::feed :page="$page">
    <x-slot:empty>Nothing has happened yet.</x-slot:empty>
</x-storyfeed::feed>

<x-storyfeed::item> ​

One item. It draws <x-storyfeed::activity> or <x-storyfeed::group>, whichever the item is.

AttributeDefaultAccepts
itema FeedItem, or a node as an array
lastfalsetrue ends the rail at this row
railnulla rail
child-railnullthe rail for a group's expanded members
interactivetruefalse draws a group without a disclosure control
collapsednulla group's initial state
timezonenullthe display zone
renderers[]renderer callbacks
SlotReplaces
defaultnothing; added to the row after its bodies

<x-storyfeed::pager> ​

The link to older activity: the current URL with the next cursor. It draws nothing when the cursor is null.

AttributeDefaultAccepts
cursorthe encoded next cursor, or null
name'cursor'the query-string key

<x-storyfeed::divider> ​

A label on the rail, drawn like a day heading.

AttributeDefaultAccepts
labelthe text
divider-style'branch'branch or dot

Rows ​

<x-storyfeed::activity> ​

An activity row: rail, headline, meta line, bodies.

AttributeDefaultAccepts
activitya FeedItem, or an activity node as an array
lastfalsetrue ends the rail at this row
densefalsetrue draws the compact row used for group members
railnulla rail
timezonenullthe display zone
renderers[]renderer callbacks
removednulla line of text under the meta line, such as "This order was deleted."
SlotReplaces
defaultnothing; added after the body renderer, before the bodies
timethe timestamp
annotationsnothing; added at the end of the row

<x-storyfeed::group> ​

A group row: headline, meta line, the strip of member pictures and the members behind a disclosure.

AttributeDefaultAccepts
groupa FeedItem, or a group node as an array
lastfalsetrue ends the rail at this row
railnulla rail
child-railnullthe rail for expanded members
interactivetruefalse draws no disclosure control
collapsednullthe initial state
timezonenullthe display zone
renderers[]renderer callbacks
removednulla line of text under the meta line
media-tilesnullthe strip's tiles; null builds them from the members
media-overflow0the "+N" count when you pass media-tiles
SlotReplaces
defaultnothing; added after the body renderer
timethe timestamp
annotationsnothing; added before the strip

<x-storyfeed::headline> ​

A headline, each entity in it linked.

AttributeDefaultAccepts
headlinea Storyfeed\Support\Headline

<x-storyfeed::meta> ​

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

AttributeDefaultAccepts
itema FeedItem, or a node as an array
headlinenullthe headline the row draws; null reads the item's
timezonenullthe display zone
time-renderernulla callback that receives the FeedItem and returns the time's HTML
SlotReplaces
defaultthe timestamp

<x-storyfeed::time> ​

When it happened: relative today, a date after that, the full time on hover.

AttributeDefaultAccepts
ata CarbonInterface, or null to draw nothing
timezonenullthe display zone
labelnulltext in place of the computed label
titlenullthe hover text in place of the full time

The Rail ​

<x-storyfeed::rail> ​

The column on the left of a row: the disc, its badge and the line to the next row.

AttributeDefaultAccepts
itema FeedItem
railnulla rail
densefalsetrue drops the badge
lastfalsetrue ends the line here
renderers[]the glyph and avatar renderers

<x-storyfeed::glyph> ​

The activity's icon, in a disc or as a badge.

AttributeDefaultAccepts
glyphnullthe payload's glyph token, such as shopping-bag; draws icons/{token}, else icons/activity
intentnullyour app's word, written to data-sf-intent
variant'disc'disc or badge
renderernulla callback that receives the token and variant and returns the icon's HTML

<x-storyfeed::avatar> ​

An entity's face: its media.icon, else its initials on its colour.

AttributeDefaultAccepts
entitya Storyfeed\Support\Entity
size'md'md, sm, pair, tile or badge

Pictures ​

<x-storyfeed::media> ​

One picture, its box reserved from its declared width and height.

AttributeDefaultAccepts
imagean image array: src, alt, width, height
hrefnulla link around the picture
link-attributes[]attributes for that link; href and event handlers are dropped
renderernullthe media renderer

<x-storyfeed::media-strip> ​

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

AttributeDefaultAccepts
tiles[]tiles from Storyfeed\Ui\Support\Strip::of($group)['tiles'], or your own {image, href} arrays
overflow0the "+N" count
renderernullthe media renderer
togglenull{expanded, controls, label}: the "+N" tile opens and closes the element with id controls

Bodies ​

<x-storyfeed::body> ​

One body, drawn by the component for its type. A type without a component draws its $fallback line, or nothing.

AttributeDefaultAccepts
bodythe body as an array, as it appears in the payload
entitynullthe entity the body belongs to
renderernullthe form renderer
media-renderernullthe media renderer
file-labellernullthe fileLabel renderer

Each built-in body type has a component under body.:

Body TypeComponent
Storyfeed/Body/CallToAction<x-storyfeed::body.call-to-action>
Storyfeed/Body/Component<x-storyfeed::body.component>
Storyfeed/Body/Excerpt<x-storyfeed::body.excerpt>
Storyfeed/Body/FileAttachment, Storyfeed/Body/File<x-storyfeed::body.file-attachment>
Storyfeed/Body/Image<x-storyfeed::body.image>
Storyfeed/Body/ItemList<x-storyfeed::body.item-list>
Storyfeed/Body/KeyValue<x-storyfeed::body.key-value>
Storyfeed/Body/MediaObject<x-storyfeed::body.media-object>
Storyfeed/Body/Prose<x-storyfeed::body.prose>
Storyfeed/Body/Table<x-storyfeed::body.table>

Any other type maps segment by segment: Acme/Shipment draws <x-storyfeed::body.acme.shipment>, a view you add under resources/views/vendor/storyfeed/components/body/acme/shipment.blade.php.

<x-storyfeed::body.call-to-action>, <x-storyfeed::body.component>, <x-storyfeed::body.excerpt>, <x-storyfeed::body.item-list>, <x-storyfeed::body.key-value>, <x-storyfeed::body.prose>, <x-storyfeed::body.table> ​

AttributeDefaultAccepts
bodythe body as an array
entitynullthe entity the body belongs to

<x-storyfeed::body.file-attachment> ​

AttributeDefaultAccepts
bodythe body as an array
entitynullthe entity the body belongs to
labellernulla callback that receives {name, mediaType} and returns a label, or null for the built-in MIME labels

<x-storyfeed::body.image> ​

AttributeDefaultAccepts
bodythe body as an array
entitynullthe entity whose media slot the body names
media-renderernullthe media renderer

<x-storyfeed::body.media-object> ​

AttributeDefaultAccepts
bodythe body as an array
entitynullthe entity the body belongs to
media-renderernullthe media renderer
image-placement'beside'beside or below the text

Renderers ​

renderers takes an array of callbacks. <x-storyfeed::feed> passes it to every row and every group member.

blade
<x-storyfeed::feed :page="$page" :renderers="[
    'time' => fn ($item) => view('feed.time', ['item' => $item])->render(),
    'fileLabel' => fn (array $file) => match ($file['mediaType']) {
        'application/vnd.apple.keynote' => 'Keynote',
        default => null,
    },
]" />
RendererReceivesReturns
timethe FeedItemthe timestamp's HTML
glyphthe glyph token, disc or badgethe icon's HTML, drawn inside the kit's disc
avatarthe Entity, md, pair or badgethe avatar's HTML
bodythe FeedItemHTML added before the row's bodies
annotationsthe FeedItemHTML added at the end of the row
removedthe FeedItemthe removal line's text, or null
fileLabel['name' => …, 'mediaType' => …]a file-kind label, or null for the built-in MIME labels
formthe body array, the owning Entity or nullthe body's HTML, or null for the kit's component
mediaTilesthe group's FeedItemthe strip's tiles
mediaOverflowthe group's FeedItemthe "+N" count
media['image' => …, 'href' => …, 'attributes' => …], a class stringthe picture's HTML, for every picture: tiles, Image and MediaObject bodies

The HTML a renderer returns is drawn as it is, without sanitizing.

Registered Components ​

Storyfeed\Ui\Support\BodyComponents maps a Component body's name to an app Blade component:

app/Providers/AppServiceProvider.phpboot()
php
use Storyfeed\Ui\Support\BodyComponents;

app(BodyComponents::class)->register('App/Message', 'feed.message');

A Storyfeed/Body/Component named App/Message renders <x-feed.message> with the body's props as its attributes. A name that isn't registered draws nothing.

Views and Words ​

Path under resources/views/vendor/storyfeedDraws
components/{name}.blade.phpthe component of that name
components/body/{type}.blade.phpa body type, its segments in kebab case
icons/{token}.blade.phpa glyph token
icons/activity.blade.phpa token with no view of its own

Publish the views with php artisan vendor:publish --tag=storyfeed-views.

WordsWhere
"No activity yet.", "Older activity", "Show all :count", "Show less", "Today", "Yesterday"lang/{locale}.json
the role words after the time, "from" and "until"lang/vendor/storyfeed-ui/{locale}/meta.php

Released under the MIT License.