Access Block Label (blockName) in Field Configuration
#16421
2nikhiltom
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
When editors create a block in Payload, they choose a "Layout name" which becomes the block's label in the admin UI. However, there's no way to access this
blockNamevalue within the block's field configurations to auto-populate related fields.Real-World Example
We have a
ContentGenericblock where editors must:This creates unnecessary duplication and potential inconsistency.
What We Need
A way to access the block's
blockNamein field configurations. For example:Or in a custom Field component:
What We've Tried
1. Using
useFormFieldsin a custom component:❌ Result: Field becomes read-only, users can't type
2. Using
defaultValuewith data parameter:❌ Result: TypeScript error -
blockNamenot in context type3. Field-level hooks:
❌ Result: No access to block-level data
Why This Matters
Environment
Current Workaround
Editors manually copy the Layout name to the heading field
Beta Was this translation helpful? Give feedback.
All reactions