defmodule PyrauiWeb.DocsLive.ConnectionsWidgetDocs do use PyrauiWeb, :html def render(assigns) do ~H"""
Social-style connections list with avatars, status indicators, mutual counts, and custom actions.
Showcase a curated set of followers with online presence, mutual connections, and a CTA slot.
type={:followers}
for inbound requests and
max_display
to limit avatar density.
:action
button to funnel users into dedicated follower dialogs or modals.
<.connections_widget connections={@followers} current_user={@user_id} type={:followers} max_display={4}>
<:action>
<button class="rounded-lg border border-blue-200 px-4 py-2 text-sm">View All</button>
</:action>
</.connections_widget>
Highlight mutual connections and quick actions to send invites or dismiss suggestions.
Use the same component to showcase recommended experts or collaborators. Populate
mutual_count
to boost social proof, and flip
is_connected
to update button copy automatically.
<.connections_widget connections={@suggestions} current_user={@user_id} type={:connections} max_display={5}>
<:action>
<button class="rounded-lg border border-emerald-200 px-4 py-2 text-sm">Refresh Suggestions</button>
</:action>
</.connections_widget>
Switch the widget to a :following context to spotlight internal teammates or cohort members.
<.connections_widget connections={@team} current_user={@user_id} type={:following} max_display={6}>
<:action>
<button class="rounded-lg border border-purple-200 px-4 py-2 text-sm">Manage Roles</button>
</:action>
</.connections_widget>
Drive the widget with a simple list of maps. Each map supports :name, :username, :mutual_count, :online, and more.
| Prop | Type | Default | Description |
|---|---|---|---|
| connections | list | [] | List of connection maps (name, avatar, mutual_count, etc.) |
| current_user | integer | nil | Current user's id, used to highlight owned connections. |
| type | :followers | :following | :connections | :followers | Changes the copy and CTA defaults per use case. |
| max_display | integer | 5 | Control how many avatars render before truncation. |
| size | :sm | :md | :lg | :md | Adjust the avatar dimensions to match your layout density. |