Skip to content
Brok UI

Loading…

No results

Activity Feed

Open source

In-app activity feeds — a timeline of events with avatars, action text and timestamps.

Preview

resources/views/blocks/activity-feed-timeline.blade.php Blade
@props([
    'title'        => 'Recent activity',
    'viewAllHref'  => '#',
    'viewAllLabel' => 'View all',
    'events'       => null,
])

@php
    $events ??= [
        ['type' => 'comment', 'actor' => 'Priya Nair', 'action' => 'commented on', 'target' => 'Q2 roadmap', 'targetVariant' => 'secondary', 'timestamp' => '2 minutes ago', 'snippet' => 'Looks great — can we move the launch date forward by a week?', 'initials' => 'PN'],
        ['type' => 'upload', 'actor' => 'Marcus Webb', 'action' => 'uploaded', 'target' => 'design-final-v3.fig', 'targetVariant' => 'outline', 'timestamp' => '34 minutes ago', 'snippet' => null, 'initials' => 'MW'],
        ['type' => 'status', 'actor' => 'Tomás Rivera', 'action' => 'changed status to', 'target' => 'In Review', 'targetVariant' => 'default', 'timestamp' => '1 hour ago', 'snippet' => null, 'initials' => 'TR'],
        ['type' => 'mention', 'actor' => 'Aisha Okonkwo', 'action' => 'mentioned you in', 'target' => 'Sprint planning', 'targetVariant' => 'secondary', 'timestamp' => '3 hours ago', 'snippet' => 'Can you take a look at the acceptance criteria before EOD?', 'initials' => 'AO'],
        ['type' => 'completed', 'actor' => 'Dev Kapoor', 'action' => 'completed task', 'target' => 'Set up CI pipeline', 'targetVariant' => 'outline', 'timestamp' => 'Yesterday at 4:52 pm', 'snippet' => null, 'initials' => 'DK'],
    ];

    $lastIndex = count($events) - 1;
@endphp

<x-ui.section space="md" {{ $attributes }}>
    <x-ui.container size="sm" gutter="sm">
        <x-ui.card>
            <div class="flex items-center justify-between border-b border-border px-6 py-4">
                <h2 class="text-base font-semibold leading-6">{{ __($title) }}</h2>
                <a href="{{ $viewAllHref }}" class="rounded-sm text-sm font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">{{ __($viewAllLabel) }}</a>
            </div>

            <ol class="px-6 py-4" aria-label="{{ __('Activity feed') }}">
                @foreach ($events as $index => $event)
                    <li class="relative flex gap-x-4 {{ $index === $lastIndex ? '' : 'pb-6' }}">
                        <div class="flex flex-col items-center">
                            <x-ui.avatar size="sm" :alt="$event['actor']" :fallback="$event['initials']" />
                            @unless ($index === $lastIndex)
                                <span class="mt-2 w-px flex-1 bg-border" aria-hidden="true"></span>
                            @endunless
                        </div>
                        <div class="min-w-0 flex-1 pt-2">
                            <p class="text-sm leading-snug">
                                <span class="font-medium text-foreground">{{ $event['actor'] }}</span>
                                <span class="text-muted-foreground"> {{ __($event['action']) }} </span>
                                @if (! empty($event['target']))
                                    <x-ui.badge :variant="$event['targetVariant'] ?? 'secondary'" size="sm">{{ $event['target'] }}</x-ui.badge>
                                @endif
                            </p>
                            <p class="mt-0.5 text-xs text-muted-foreground"><time>{{ __($event['timestamp']) }}</time></p>
                            @if (! empty($event['snippet']))
                                <blockquote class="mt-2 rounded-md bg-muted px-4 py-2 text-sm text-muted-foreground">{{ $event['snippet'] }}</blockquote>
                            @endif
                        </div>
                    </li>
                @endforeach
            </ol>
        </x-ui.card>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/activity-feed-timeline

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/activity-feed-timeline writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.0.4
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/activity-feed-timeline.blade.php

Registry dependencies

avatar badge card container section

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.

activity-feed-timeline.md
# Brok UI block: Activity Feed (`activity-feed-timeline`)

An application activity feed — a card-wrapped vertical timeline of events with avatars, action text, target badges, timestamps and quoted snippets.

Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add blocks/activity-feed-timeline
```

## Render it

```blade
<x-blocks.activity-feed-timeline />
```

## Props

- `title` (string, default `Recent activity`)
- `view-all-href` (string, default `#`)
- `view-all-label` (string, default `View all`)
- `events` (mixed|null, default `null`)

## Use when

- Showing a card-wrapped vertical timeline of recent application events with avatars, action text and timestamps.
- Surfacing a quoted snippet, such as a comment body, inline with the event that produced it.

## Avoid when

- Use activity-feed-grouped to group events under day headers, or activity-feed-compact for a dense, compact audit log.

## Rules

- Render the installed block with `<x-blocks.activity-feed-timeline />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.

## Links

- Docs: https://brokui.dev/blocks/activity-feed-timeline
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/activity-feed-timeline.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

Guidance

Use when

  • Showing a card-wrapped vertical timeline of recent application events with avatars, action text and timestamps.
  • Surfacing a quoted snippet, such as a comment body, inline with the event that produced it.

Avoid when

  • Use activity-feed-grouped to group events under day headers, or activity-feed-compact for a dense, compact audit log.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.activity-feed-timeline />

Built from primitives

Composes <brok:*> Semantic tokens Re-themeable RTL-ready

This block composes installed <brok:*> primitives and semantic design tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by editing CSS variables; flip the preview to RTL to confirm it mirrors.

Source

The exact, editable file ui:add writes into your app. The preview above renders this same source — there are no preview-only blocks.

resources/views/blocks/activity-feed-timeline.blade.php Blade
@props([
    'title'        => 'Recent activity',
    'viewAllHref'  => '#',
    'viewAllLabel' => 'View all',
    'events'       => null,
])

@php
    $events ??= [
        ['type' => 'comment', 'actor' => 'Priya Nair', 'action' => 'commented on', 'target' => 'Q2 roadmap', 'targetVariant' => 'secondary', 'timestamp' => '2 minutes ago', 'snippet' => 'Looks great — can we move the launch date forward by a week?', 'initials' => 'PN'],
        ['type' => 'upload', 'actor' => 'Marcus Webb', 'action' => 'uploaded', 'target' => 'design-final-v3.fig', 'targetVariant' => 'outline', 'timestamp' => '34 minutes ago', 'snippet' => null, 'initials' => 'MW'],
        ['type' => 'status', 'actor' => 'Tomás Rivera', 'action' => 'changed status to', 'target' => 'In Review', 'targetVariant' => 'default', 'timestamp' => '1 hour ago', 'snippet' => null, 'initials' => 'TR'],
        ['type' => 'mention', 'actor' => 'Aisha Okonkwo', 'action' => 'mentioned you in', 'target' => 'Sprint planning', 'targetVariant' => 'secondary', 'timestamp' => '3 hours ago', 'snippet' => 'Can you take a look at the acceptance criteria before EOD?', 'initials' => 'AO'],
        ['type' => 'completed', 'actor' => 'Dev Kapoor', 'action' => 'completed task', 'target' => 'Set up CI pipeline', 'targetVariant' => 'outline', 'timestamp' => 'Yesterday at 4:52 pm', 'snippet' => null, 'initials' => 'DK'],
    ];

    $lastIndex = count($events) - 1;
@endphp

<x-ui.section space="md" {{ $attributes }}>
    <x-ui.container size="sm" gutter="sm">
        <x-ui.card>
            <div class="flex items-center justify-between border-b border-border px-6 py-4">
                <h2 class="text-base font-semibold leading-6">{{ __($title) }}</h2>
                <a href="{{ $viewAllHref }}" class="rounded-sm text-sm font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">{{ __($viewAllLabel) }}</a>
            </div>

            <ol class="px-6 py-4" aria-label="{{ __('Activity feed') }}">
                @foreach ($events as $index => $event)
                    <li class="relative flex gap-x-4 {{ $index === $lastIndex ? '' : 'pb-6' }}">
                        <div class="flex flex-col items-center">
                            <x-ui.avatar size="sm" :alt="$event['actor']" :fallback="$event['initials']" />
                            @unless ($index === $lastIndex)
                                <span class="mt-2 w-px flex-1 bg-border" aria-hidden="true"></span>
                            @endunless
                        </div>
                        <div class="min-w-0 flex-1 pt-2">
                            <p class="text-sm leading-snug">
                                <span class="font-medium text-foreground">{{ $event['actor'] }}</span>
                                <span class="text-muted-foreground"> {{ __($event['action']) }} </span>
                                @if (! empty($event['target']))
                                    <x-ui.badge :variant="$event['targetVariant'] ?? 'secondary'" size="sm">{{ $event['target'] }}</x-ui.badge>
                                @endif
                            </p>
                            <p class="mt-0.5 text-xs text-muted-foreground"><time>{{ __($event['timestamp']) }}</time></p>
                            @if (! empty($event['snippet']))
                                <blockquote class="mt-2 rounded-md bg-muted px-4 py-2 text-sm text-muted-foreground">{{ $event['snippet'] }}</blockquote>
                            @endif
                        </div>
                    </li>
                @endforeach
            </ol>
        </x-ui.card>
    </x-ui.container>
</x-ui.section>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.0.4
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0