Skip to content
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

feat(Forms): add support for conditional function based info, warning and error props to all Field.* components #4421

Merged
merged 18 commits into from
Jan 13, 2025

Conversation

tujoworker
Copy link
Member

@tujoworker tujoworker commented Dec 20, 2024

The PR updates the info, warning, and error props to accept functions. This makes it easier to create conditional messages without relying on making a field "controlled."

Additionally, it ensures the same user experience for displaying these messages (by using the conditionally function), consistent with how error messages are handled by default today.

<Field.Number info={(value, { conditionally, getValueByPath }) => {
  return conditionally(() => 'Show this message, with this value ' + getValueByPath('/otherField'))
}} />

Here's an example.

Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 13, 2025 1:20pm

@tujoworker tujoworker force-pushed the feat/forms-conditional-infos branch 2 times, most recently from 340f89a to 7186ba7 Compare December 20, 2024 12:09
Copy link

codesandbox-ci bot commented Dec 20, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@tujoworker tujoworker force-pushed the feat/forms-conditional-infos branch 3 times, most recently from 88103c6 to 724b68b Compare January 13, 2025 08:18
@tujoworker tujoworker force-pushed the feat/forms-conditional-infos branch from 16db283 to a83e86b Compare January 13, 2025 13:04
@tujoworker tujoworker merged commit ad13e23 into main Jan 13, 2025
10 checks passed
@tujoworker tujoworker deleted the feat/forms-conditional-infos branch January 13, 2025 13:20
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.

3 participants