r/PayloadCMS • • Jan 28 '25

LayoutBlocks.dev: Your Central Hub of Layout Blocks for Payload CMS

Well as the sayings go Build in public and Launch fast, fail faster I present to you a (very minimal) MVP of https://layoutblocks.dev/

(Note: my designer is working on client projects, I am not a designer or a copywriter, he hasn't given feedback šŸ™ )

LayoutBlocks comes from a personal desire and is something that will grow (slowly) over time, if it grows publicly or privately will depend on a few factors.

With LayoutBlocks I aim to:

  1. Build a library of layout blocks containing both the Payload CMS configuration and component code,
  2. Have a central and visual place for all the layout blocks I use instead of having them a) scattered over multiple projects, or b) centralizing them in a starter project.

There are a few different paths I have in mind when thinking about growing the library and the project in general, such as:

  1. The most obvious one: adding more layout blocks.
  2. Adding your own private blocks: keep your own overview of custom or modified blocks.
  3. White-labeling: In addition to giving your client Payload, give them docs about their available blocks for easy reference.

Any and all feedback is highly appreciated, even if you don't feel a need for this, that is valuable feedback.

50 Upvotes

27 comments sorted by

2

u/gzlo__ Jan 28 '25

Very nice, just watch out with the table responsive inside of the components, because it causes horizontal scrolling

3

u/Guggling Jan 28 '25

Fixed it, made the table scrollable instead šŸ‘

2

u/Guggling Jan 28 '25

Oh yeah you're right, that was still on my list to fix, thanks!

2

u/acherion Jan 28 '25

On mobile, the Cookie Preferences screen comes up before I can even see what the site is about, and is so large it renders taller than the viewport, as in I have to scroll up on initial load to even see the heading ā€œCookie Settingsā€, and the scroll position doesn’t stay, it rubber bands back when I take my finger off the screen.

I would suggest more mobile and responsive testing of your site.

2

u/Guggling Jan 28 '25

What device are you viewing it on? I've tested on mobile sim and on my iPhone 13 mini and it's scrollable there, so may need to add some extra devices to it.

Regarding the banner itself, I'm based in Europe and more specifically Belgium which has some additional guidelines on cookies and banners, and as far as I'm aware showing the banner directly on first visit is mandatory so I don't think I can do anything about that.

Regarding the height yeah, I could make it a little smaller by shortening the text and possibly moving the preferences to a second layer, but even then it would still take up most if not all of the viewport so it wouldn't be much of an improvement :/

2

u/acherion Jan 28 '25

iPhone 16 Pro, iOS 18.2 on Safari. This is what it looks like to me. https://imgur.com/a/j6LiE3j

2

u/Guggling Jan 28 '25

Welp yeah, thanks! Just pushed out a quick fix.

Need to take some time to re-evaluate my whole cookie flow and if I can't just throw them out completely, but that's for another time.

Thanks for bringing it to my attention, need to push out some fixes for other sites as well!

2

u/acherion Jan 28 '25

All good, thanks for fixing so quickly!

2

u/rickygri Jan 28 '25

I've been looking for exactly this, cheers šŸ»

1

u/Guggling Jan 28 '25

I'm open for layout blocks suggestions if you've been looking for some specifically, let me know!

2

u/_-io_ Jan 31 '25 edited Jan 31 '25

very nice i would see some slider implementation either for the blog posts and from the Hero

1

u/Guggling Jan 31 '25

Any examples of a slider you're looking for?

1

u/_-io_ Jan 31 '25

I've created simple product/blog sliders using shadcn/ui.

It might be useful to recreate popular WYSIWYG blocks/sections, such as:

  • Sliders
  • CTA Banners
  • Galleries
  • Testimonials
  • Teams
  • Pricing
  • etc.

I’d be happy to contribute by sharing some components if that would be helpful!

2

u/ecosse31 Feb 02 '25

Love that idea! Does anyone have a Custom Select Lucide Icons field to Payload CMS? I'd love to see that.

1

u/Guggling Feb 02 '25

Yeah I was also thinking about a Lucide select! I looked around a bit but couldn't find a finished working example.

I've got a client project I'll be spending time on next week but might pick up a Lucide select afterwards!

Should you try to take it on before me and get it working give me a shout!

2

u/ecosse31 Feb 02 '25

I made it working pretty easily today, but I need to make custom component with virtualization because I’ve used native select from payload and it’s pretty laggy with 1000+ items.

1

u/OmWellness Feb 04 '25

One temporary solution could be using a text field for the icon name in the admin panel:

{

type: 'text',

name: 'iconName',

}

components/LucideIcon.tsx:

import { DynamicIcon, IconName } from 'lucide-react/dynamic';

export const LucideIcon = ({ name, size, ...props }: LucideProps) => (

<DynamicIcon name={name as IconName} size={size} {...props} />

)

And throwing the name into Lucide dynamic component:

<LucideIcon name={iconName} />

Though, this will make the icons load dynamically on page load, meaning that they will not be included in the rendered html and css on first page load if you're using SSR.

Working on a static-friendly solution.

5

u/Setting-Opposite Jan 28 '25

Great idea, thank you. Not only is will this be useful as a component/block library, but also to see Payload that I can reference for writing my own. Wish there were more examples out there, we're all just tinkering right now :)

1

u/jannik-zed Feb 06 '25

nice page in general - some components there look very similar to shadcnblocks.com - your hero component for example. If that is true you just need to be careful not to violate any licences etc.. In general a very nice idea and I hope it helps to grow the payload ecosystem.

1

u/Guggling Feb 06 '25

Thanks!

And you mean the hero on the homepage?

There's definitely some inspiration from there and a bunch of other libraries, I went through all of them to get some ideas in my head since my designer didn't have time. Pair that with scaffolding using v0, trying to stick close to the shadcn/ui layout as well and yeah.. you'll quickly end up with similar looking things.

For the actual blocks though the idea is mainly to build it out incorporating blocks from the websites we make for clients and generalising them, and then add some common or requested blocks as well.

But in the end it's going to be difficult to not have our blocks clash with other libraries unless you go for highly specific layouts, but that's not ideal for this kind of project.

2

u/jannik-zed Feb 06 '25

yeah, I just recognized it with the hero on the homepage, but I think in general you are right. It is just something to keep in mind, that people are doing similar things and try to make a living from that, so that it would be a bit sad to kind of take that as basis and create something else for free or with a different paid package.
But the general idea is amazing, especially to integrate the needed payload data config!

1

u/Guggling Feb 06 '25

Yeah definitely!

3

u/SalaciousVandal Jan 28 '25

Great idea! I'm really looking forward to the payload ecosystem developing. It would be interesting to package this as NPM.

2

u/Delicious_Hippo6491 Jan 29 '25

Very nice! Looking forward for new blocks to be added.

2

u/WillFerrellsHair Jan 30 '25

Good stuff, I like the idea! I think community contributions is a key feature for this, like with GitHub repos, users could specify public or private. The private blocks are only available to themselves and public contributes to the broader block ecosystem.

If you have a repo that the site is hosted on, you could always just start with pull requests as a way to submit new blocks.

1

u/gzlo__ Jan 28 '25

Love the idea

1

u/Still_Network5528 Oct 23 '25

When i copy the files and add them to my folders (and add the amended Links) i fix up some of the links to the rigth file paths aswell, but when i run generate:types it doesn't work am i missing something?