urgent-maroonU
Refine3y ago
44 replies
urgent-maroon

I want to combine option labels in the useSelect hook of refine antd.

This only shows firstName as label as expected.
  const { selectProps: userSelectProps } = useSelect({
    resource: "users",
    defaultValue: ordersData?.userId,
    optionLabel: "firstName",
    optionValue: "id",
  });

I want to show both firstName and lastName. Is there a way to acheive this? I wanted something like:
  const { selectProps: userSelectProps } = useSelect({
    resource: "users",
    defaultValue: ordersData?.userId,
    optionLabel: (option) => `${option.firstName} ${option.lastName}`,
    optionValue: "id",
  });
Was this page helpful?