Skip to content

Blocks Field - Components docs inaccurate #12112

Open
@damnsamn

Description

@damnsamn

Documentation Issue

The Blocks Fields page in the docs lists a RowLabel component which is not exported with the BlocksField types. Presumably this was just copied across from the Array Field docs in error, but it does speak to an unmet need with the Blocks field. I think it should have a RowLabel component (or equivalent) to replace blockName. See this discussion #4648

The relevant erroneous section:

Row Label

'use client'

import { useRowLabel } from '@payloadcms/ui'

export const BlockRowLabel = () => {
  const { data, rowNumber } = useRowLabel<{ title?: string }>()

  const customLabel = `${data.type} ${String(rowNumber).padStart(2, '0')} `

  return <div>Custom Label: {customLabel}</div>
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions