strapi-plugin-grid-view
v0.1.11
Published
A card grid for the Strapi content manager list view, similar to the Media Library. Plus full-size previews for the images in it.
Maintainers
Readme
Strapi plugin grid view
Two ways to see media in the Strapi content manager.
Grid view adds a button to the list view, next to the view settings cog, that switches it between Strapi's list and a card grid. Just like it does with the Media Library. The choice is remembered per collection type, per browser - a table of covers can stay a grid while a table of short fields stays a list.
Image previews put the full-size image on screen wherever Strapi already offers a look at one: the popover over a media cell in the list view, and the carousel on a media field in an entry. Both normally show a thumbnail, so the file name is swapped for the original on the way in.
Worth knowing before you install: a preview therefore downloads the original file rather than the ~245px thumbnail Strapi generated. That is the point - a thumbnail stretched over the screen is not worth looking at - but on a library of large uploads it is real bandwidth, paid on hover.
Built for Strapi 5, admin only - it adds no routes, content types or server code.
Installation
npm install strapi-plugin-grid-view
# or
yarn add strapi-plugin-grid-viewInstalled plugins are enabled by default, so there is nothing to configure. To turn it off without
uninstalling, add it to config/plugins.ts:
export default () => ({
'grid-view': { enabled: false },
});Styling
Grid view is a class on the document body, so anything else can style against it too:
body.grid-view table[role="grid"] > tbody > tr {
/* your own card */
}Adding grid-view-pinned to the body alongside it pins the view: the plugin then leaves the class
alone instead of setting it per collection type on every navigation. Useful when the list view is
embedded as a picker and should always be a grid, whatever the person browsing normally prefers.
The plugin's own rules are in admin/src/GridView.css. They lay the table rows out as cards and give the first image cell a checkerboard backdrop, in both the light and dark admin themes. The preview rules are in admin/src/ImagePreview.css.
Both stylesheets are inlined into the bundle and injected into <head> at register time, so there
is nothing for you to import.
Development
The plugin is built with @strapi/sdk-plugin.
yarn install
yarn build # emits dist/, which the exports field points at
yarn watch # rebuild on change
yarn test:ts # typecheckTo try a change in a real Strapi app, yarn watch:link rebuilds on change and pushes the package
through yalc; on the app side, yalc add strapi-plugin-grid-view.
Licence
MIT
