PhoenixKitDashboards.Widgets.NoteWidget (PhoenixKitDashboards v0.1.0)

Copy Markdown View Source

Built-in "Note" widget — a title + free-text body from its settings, with the body rendered as Markdown (GFM, XSS-sanitized via core's <.markdown>), so links, lists and emphasis actually work in a pinned note.

Otherwise the simplest possible widget: pure presentation, no data loading. Use it as the reference shape for a custom widget Phoenix.LiveComponent.

Widget LiveComponent contract

The dashboard host renders every widget as:

<.live_component
  module={widget.component}
  id={instance_id}
  settings={instance_settings}
  view={selected_view}          # nil or a declared view key
  size={%{w: w, h: h}}          # the instance's current span
  scope={@phoenix_kit_current_scope}
/>

So a widget component handles the :settings, :view, :size, and :scope assigns (all optional to read). It runs inside the host LiveView's process (LiveComponents have no process of their own), so for live data a widget's catalog entry declares a refresh_interval (ms) and the host re-send_update/2s it on that cadence — the widget never subscribes/times itself.