Using a relationships entry title as a repeatable components entry title


I just thought I would share an extension I’ve working on. In my project, we link many content entries together using relationships inside components. However, it’s currently not possible to make the title of a repeatable component to be the entry title of a relationship established inside of the component. Ex:

In this example, I would want the title of the Button relationship to show in the expandable repeatable component.

I was able to do this by extending this file: extensions/content-manager/admin/src/components/RepeatableComponent/DraggedItem/utils/select.js

import { useMemo } from 'react';
import { get, toString } from 'lodash';
import { useContentManagerEditViewDataManager } from 'strapi-helper-plugin';

function useSelect({ schema, componentFieldName }) {
  const {
  } = useContentManagerEditViewDataManager();

  const mainField = useMemo(() => get(schema, ['settings', 'mainField'], 'id'), [schema]);
  const nestedObjectTitle = schema.layouts.edit?.[0]?.[0]?.metadatas?.mainField?.name;
  const nestedObjectField = schema.layouts.edit?.[0]?.[0]?.name;
  const displayValuePath = (mainField === 'id' && !!nestedObjectTitle)
    ? [...componentFieldName.split('.'), nestedObjectField, nestedObjectTitle]
    : [...componentFieldName.split('.'), mainField];
  const displayedValue = toString(
    get(modifiedData, displayValuePath, '')

  return {

export default useSelect;

With this extension, the repeatable component will attempt to use the first items relationship entry title if a title for the repeatable component has not be specified.
Here is the result:

Just wanted to share in case someone was trying to solve the same problem!

1 Like

Hey, I created this file exactly where you mentioned but it didn’t work. It’s still giving me only one option “id”. So, I thought maybe it isn’t extending for some reason so I went to the node_modules and edited this file there. It still didn’t work =(

Any hints?

@starrett67 Thank you, this saved me a ton of searching!

@dydx-git Do you have strapi running with npm run develop -- --watch-admin so that it builds the admin interace when a file is changed? Also make sure to configure the view to make it show the id as entry title. I added the supplied code to extensions and it worked out of the box like a charm!