Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Custom Leaf/Element in Slate

default discord avatar
pooledgelast year
4

I've learned that Payload is moving to Lexical, but in the meanwhile, is there any full example of how to make these possible? I'm sort of in the dark here.



Let's say I'd need just a basic

Larger

and

Smaller

leafs to alter text size accordingly. Creating and assigning toolbar button is a breeze, but what's next? How to assign an

onClick

event to render a custom Leaf/Element inside the Editor?



If someone has done this previously I'd love to learn! Thx

  • default discord avatar
    notchrlast year
    @633347394985263119

    Have you seen any of the examples of customs leaf tags / buttons? I believe they exist in the different payload example repos. I've personally created a text color leaf at one point. Let me know if you can find any of those examples, if not, happy to find my old example

  • default discord avatar
    pooledgelast year
    @1049775120559898725

    any example helps, thank you!

  • default discord avatar
    notchrlast year
    @633347394985263119

    You may have to browser this thread a bit, but this was the discussion when I was building a custom color button

    https://discord.com/channels/967097582721572934/1085263676791062528/1088517710922661898
  • default discord avatar
    pooledgelast year

    Got it, thanks!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.