Skip to content

Commit 4ed0448

Browse files
committed
fix: accept react-style text area readOnly
1 parent 918949e commit 4ed0448

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

libs/radix-ui-themes/src/components/text-area.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { GetPropDefTypes } from '../props/prop-def.js';
1212
type TextAreaElement = React.ElementRef<'textarea'>;
1313
type TextAreaOwnProps = GetPropDefTypes<typeof textAreaPropDefs> & {
1414
defaultValue?: string;
15+
readOnly?: boolean;
1516
value?: string;
1617
};
1718
interface TextAreaProps
@@ -20,8 +21,11 @@ interface TextAreaProps
2021
MarginProps,
2122
TextAreaOwnProps {}
2223
const TextArea = React.forwardRef<TextAreaElement, TextAreaProps>((props, forwardedRef) => {
24+
const { readOnly, readonly, ...restProps } = props as TextAreaProps & {
25+
readonly?: boolean;
26+
};
2327
const { className, color, radius, style, ...textAreaProps } = extractProps(
24-
props,
28+
{ ...restProps, readonly: readOnly ?? readonly },
2529
textAreaPropDefs,
2630
marginPropDefs,
2731
);

0 commit comments

Comments
 (0)