react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Add emptyText property to SelectArrayInput

Open MichaelTamm opened this issue 11 months ago • 4 comments

It would be nice to allow to specify what should be rendered inside a SelectArrayInput when no choice is selected. This feature is already present in the SelectInput.

For example:

const channelChoices = [
    {id: "email", name: "Email"},
    {id: "push", name: "Push Notification"},
];
<SelectArrayInput source="channels" choices={channelChoices} emptyText={<i>All Channels</i>} />

MichaelTamm avatar Jan 20 '25 13:01 MichaelTamm

Indeed! Can you open a PR?

djhi avatar Jan 20 '25 13:01 djhi

Hello, I'm a software engineering student I wanted to make my first contribution to an open source repository, can I act on this issue?

Tomas025 avatar Jan 20 '25 14:01 Tomas025

Hi @Tomas025, of course! Be aware that you'll need to:

  • target the next branch as this is a new feature
  • add a story for this new prop in https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/input/SelectArrayInput.stories.tsx
  • add tests in https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/input/SelectArrayInput.spec.tsx using the story above
  • add documentation for this new prop in https://github.com/marmelab/react-admin/blob/master/docs/SelectArrayInput.md

djhi avatar Jan 20 '25 15:01 djhi

Good afternoon, I uploaded a PR adding the empty Text, could you check please #10504

Tomas025 avatar Feb 08 '25 19:02 Tomas025