Skip to content

Commit

Permalink
[docs] Explain how the error prop works in the Unstyled Input (mui#…
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak authored and felipe.richter committed Dec 6, 2022
1 parent 6a82d3a commit 16a01e5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
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

0 comments on commit 16a01e5

Please sign in to comment.