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

[docs] Explain how the error prop works in the Unstyled Input #35171

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"defaultValue": "The default value. Use when the component is not controlled.",
"disabled": "If <code>true</code>, the component is disabled. The prop defaults to the value (<code>false</code>) inherited from the parent FormControl component.",
"endAdornment": "Trailing adornment for this input.",
"error": "If <code>true</code>, the <code>input</code> will indicate an error. The prop defaults to the value (<code>false</code>) inherited from the parent FormControl component.",
"error": "If <code>true</code>, the <code>input</code> will indicate an error by setting the <code>aria-invalid</code> attribute on the input and the <code>Mui-error</code> class on the root element. The prop defaults to the value (<code>false</code>) inherited from the parent FormControl component.",
"id": "The id of the <code>input</code> element.",
"maxRows": "Maximum number of rows to display when multiline option is set to true.",
"minRows": "Minimum number of rows to display when multiline option is set to true.",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/InputUnstyled/InputUnstyled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ InputUnstyled.propTypes /* remove-proptypes */ = {
*/
endAdornment: PropTypes.node,
/**
* If `true`, the `input` will indicate an error.
* If `true`, the `input` will indicate an error by setting the `aria-invalid` attribute on the input and the `Mui-error` class on the root element.
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
*/
error: PropTypes.bool,
Expand Down
7 changes: 6 additions & 1 deletion packages/mui-base/src/InputUnstyled/InputUnstyled.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface MultiLineInputUnstyledProps {
}

export type InputUnstyledOwnProps = (SingleLineInputUnstyledProps | MultiLineInputUnstyledProps) &
UseInputParameters & {
Omit<UseInputParameters, 'error'> & {
'aria-describedby'?: string;
'aria-label'?: string;
'aria-labelledby'?: string;
Expand All @@ -79,6 +79,11 @@ export type InputUnstyledOwnProps = (SingleLineInputUnstyledProps | MultiLineInp
* Trailing adornment for this input.
*/
endAdornment?: React.ReactNode;
/**
* If `true`, the `input` will indicate an error by setting the `aria-invalid` attribute on the input and the `Mui-error` class on the root element.
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
*/
error?: boolean;
/**
* The id of the `input` element.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/InputUnstyled/useInput.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface UseInputParameters {
*/
disabled?: boolean;
/**
* If `true`, the `input` will indicate an error.
* If `true`, the `input` will indicate an error by setting the `aria-invalid` attribute.
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
*/
error?: boolean;
Expand Down