-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
chore: supplement validation behavior #3106
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1891c2a
chore(input): set validationBehavior to native
wingkwong d890270
chore(docs): revise validate content in input
wingkwong 60e9fcc
chore(input): set validationBehavior to native
wingkwong 7c253f8
chore(docs): add Validation Behavior to breaking change
wingkwong 6bd9af8
chore(docs): revise content in cli
wingkwong 2447a15
chore(docs): fix typo
wingkwong c00316e
chore(docs): update validate in other components
wingkwong ec9600b
chore(docs): update validate content
wingkwong 597213a
chore(input): undo validationBehavior
wingkwong 1e84b98
refactor(docs): revise validate content
wingkwong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,7 +230,7 @@ The disabled option(s) will be displayed in the bottom of the list. | |
|
||
### Doctor Command add peerDependencies check | ||
|
||
The `doctor` command now checks for peerDependencies and displays the incorrect peerDependencies, relation: [nextui-org/nextui#2954](https://github.com/nextui-org/nextui/issues/2954). | ||
The `doctor` command now checks for peerDependencies and displays the incorrect peerDependencies. (See [nextui-org/nextui#2954](https://github.com/nextui-org/nextui/issues/2954) for more). | ||
|
||
<Spacer y={4} /> | ||
|
||
|
@@ -266,8 +266,20 @@ you need to update the import as follows: | |
+ import {cn} from "@nextui-org/theme" | ||
``` | ||
|
||
<Spacer y={4} /> | ||
### Validation Behavior | ||
|
||
Since v2.4.0, we've changed the default validation behavior to `aria` which means no native validation is applied. If you wish to use the native validation, you can set `validationBehavior` to `native` to the input components or set it to the Provider as stated above. | ||
|
||
For those who use `validationBehavior="aria"`, `validate` will be no longer applied since it is only for native validation. Therefore, you need to switch to use `isInvalid` prop instead. | ||
|
||
```tsx | ||
<form onSubmit={onSubmit}> | ||
<Input errorMessage={formErrors?.field1} isInvalid={!!formErrors?.field1} name="field1" /> | ||
<Button type="submit">Submit</Button> | ||
</form> | ||
Comment on lines
+276
to
+279
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
``` | ||
|
||
<Spacer y={4} /> | ||
|
||
## Other Changes | ||
|
||
|
@@ -307,6 +319,7 @@ you need to update the import as follows: | |
- Refactored the useScrollPosition hook to improve performance and stability by using useCallback for the handler function and useRef for throttleTimeout. [PR](https://github.com/nextui-org/nextui/pull/3049) - [@Gaic4o](https://github.com/Gaic4o) | ||
|
||
**Documentation**: | ||
|
||
- Updated documentation to reflect the new features and changes in the components, API references, and CLI. | ||
|
||
Special thanks to NextUI Team members [@kuri-sun](https://github.com/kuri-sun), [@ryo-manba](https://github.com/ryo-manba), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The form does not prevent submission, but the
validate
function will display error messages.