#Make ArrayField label dynamic

7 messages · Page 1 of 1 (latest)

opaque oxide
#

I have this piece of code:


    <ArrayField
      path={path}
      field={{
        type: "array",
        name: path,

        // Make this dynamic
        label: "dynamic",

        fields: props.field.fields[0].fields,
      }}
      readOnly={true}
      permissions={true}
    />

Is it possible to make the label dynamic based on an array item?

I use this code to fill each row:

const { value, setValue } = useField<variants>({ path, validate: () => true });
limpid latchBOT
crimson badge
opaque oxide
#

Yes, I tried using that, but since I'm using a custom component, it's not overwriting it.:(

type: "array",
name: "variants",
admin: {
  readOnly: true,
  components: {
    Field: "@/lib/payload/collections/products/ui/VariantOptions",
    // Not working since I use a custom component
    RowLabel: ''
  },
}
crimson badge
opaque oxide
#

Ah yes strange.. It does work when I click save. I guess I leave it like this for now..
Thanks for the help!!

limpid latchBOT