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

fix(input): prevent clearable when input is readonly #3643

Merged
2 changes: 1 addition & 1 deletion packages/components/input/src/use-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
typeof props.errorMessage === "function"
? props.errorMessage({isInvalid, validationErrors, validationDetails})
: props.errorMessage || validationErrors?.join(" ");
const isClearable = !!onClear || originalProps.isClearable;
const isClearable = !originalProps.isReadOnly && (!!onClear || originalProps.isClearable);
const hasElements = !!label || !!description || !!errorMessage;
const hasPlaceholder = !!props.placeholder;
const hasLabel = !!label;
Expand Down