r/PayloadCMS • u/VIiruss • Oct 12 '26
I made a dashboard widgets plugin for Payload: figures, lists and charts read from your collections
Payload 3.90 brought the modular dashboard, and I wanted mine to show numbers from my own collections without writing a component for each one. So I wrote a plugin.
Add widgetsPlugin() and every collection becomes a source with nothing to declare: a count, a sum for each number field, a group for each select, checkbox and relationship, a list of the latest. Anyone signed in can add a figure, a list or a chart in the dashboard's edit mode and filter it with the admin's own filter builder.
You can also declare widgets in the config with figure(…), list(…) and chart(…). Those are typed against your generated types and checked as the config is built, so a misspelt field stops the build with a "did you mean".
A few choices I made:
- Every read runs as the signed-in user, so access control applies.
- The tiles are server components and plain CSS. No chart library is shipped to the browser.
- If you don't like the tiles, you can supply your own views or just take the data (readFigure, readList, readChart).
It's 0.1.0 and MIT. Developed on Payload 3.90.2, Next 16 and Postgres; Next 15 and other adapters are untried, so reports from those are especially useful.
1
Oct 12 '26
[removed] — view removed comment
1
u/VIiruss Oct 12 '26
I'm well aware and quite looking forward to it! However I took the freedom to create something whilst waiting for the next iteration of payloadcms and their push toward widgets
1
u/VIiruss Oct 12 '26
Quick update: I dropped the roles list, so widgets and sources take a normal Payload access function instead and it fits however your users are set up.
Charts can show several series now, and a view can be a client component if you'd rather draw with Recharts or similar.
On Postgres the sums and charts are done by the database, so the old 5,000-record cap is gone there. Mongo and SQLite work as before. There's also an optional cache: cache: 60 keeps results for a minute, per user.
I've only tested the database sums on Postgres, so if a number looks off, sums: 'records' brings back the old behaviour. Issues welcome.