Creating this from #general (https://discord.com/channels/967097582721572934/967097582721572937/1089952369497878608
Hey @hosmelq i'd just build a custom
component for your
field that's just a little "wrapper" around the built-in Code field
there, you can use the
hook to retrieve the field's value that will determine your code field's language
and then adjust the props, and send to the built-in Code field
That's awesome 😱
Is it a package?
no, you want to render the built-in field straight from Payload itself
we don't expose the built-in Code field directly, but you can easily import it from dist
import CodeField from 'payload/dist/admin/components/forms/field-types/Code
Ok, perfect. Thank you!
To render this custom field i need to use the
no, you would want to use the
because you still want to store the data in the same way that the
field will do
field type will not store anything in the database at all
that field type is good for cases where you just wanna inject a button, or a third-party integration, or something, into the admin UI - - but not store data
instead, what you want to do is just have a code field, but simply render a custom code field component
Ok, got it. I have to use the
I made it works with the following code.