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.

Remove element type for richTexy

default discord avatar
akacronoslast year
2

I want to remove de code button from a richtext field, i don't add it in my

admin:elements[]

is there a way to remove it?

  • discord user avatar
    jesschow
    last year

    Hi @akacronos, what you're doing is correct however

    code

    is not an element it is a leaf. You can see which options are elements vs leaves here:

    https://payloadcms.com/docs/fields/rich-text#admin-config

    So if you add the leaves property and don't include 'code' then this option will be hidden.



        {
          name: 'content',
          type: 'richText',
          admin: {
            leaves: [
              'bold',
              'italic'
            ],
          }
        },

    For example this would just show bold and italic - or if you had an empty array here none would show.

  • default discord avatar
    akacronoslast year

    Oh, thanks!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.