Skip to content

Docs/add custom fields documentation #10738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ghadabezine
Copy link
Contributor

Description

This PR adds documentation explaining best practices for creating custom field components in react-admin, with a specific focus on using defaultProps for labels. This addresses issue #10684.

Changes

  • Created new documentation file docs/CustomFields.md
  • Added comprehensive guide on creating custom field components
  • Included detailed examples of using defaultProps for labels
  • Added best practices for field component development
  • Provided usage examples with different label configurations

Related Issues

Closes #10684

Documentation

The new documentation covers:

  1. Basic structure of custom field components
  2. Using defaultProps for labels
  3. Best practices for field component development
  4. Complete example with all best practices
  5. Usage examples with different configurations

The documentation emphasizes the importance of using defaultProps for labels to ensure consistency and maintainability across custom field components.

Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Why did you update SelectArrayInput?

@slax57
Copy link
Contributor

slax57 commented May 13, 2025

Also, I'm not sure this PR goes in the right direction. To me, fzaninotto's answer rather suggested we want to move away from defaultProps, as they are deprecated and will be removed.

At the very best we can clarify why they are still needed in some cases, and make it clear they are deprecated so alternatives should be considered, but IMHO we should not say adding defaultProps is recommended.

Also, I believe we should update the existing doc section rather than creating a new one (which is not referenced in the navigation menu btw).

Lastly, I believe the addLabel prop is no longer relevant in RA v5.

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

defaultProps recommended for label of custom field
3 participants