Skip to content

Commit

Permalink
feat: Input.TextArea support rootClassName (ant-design#44058)
Browse files Browse the repository at this point in the history
* feat: Input.TextArea support rootClassName

* feat: optimize code

* feat: optimize code

* feat: add rootClassName test
  • Loading branch information
kiner-tang authored Aug 7, 2023
1 parent 77ecdcb commit dcba47b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/input/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface TextAreaProps extends Omit<RcTextAreaProps, 'suffix'> {
bordered?: boolean;
size?: SizeType;
status?: InputStatus;
rootClassName?: string;
}

export interface TextAreaRef {
Expand All @@ -39,6 +40,8 @@ const TextArea = forwardRef<TextAreaRef, TextAreaProps>((props, ref) => {
allowClear,
showCount,
classNames: classes,
rootClassName,
className,
...rest
} = props;
const { getPrefixCls, direction } = React.useContext(ConfigContext);
Expand Down Expand Up @@ -87,6 +90,7 @@ const TextArea = forwardRef<TextAreaRef, TextAreaProps>((props, ref) => {
{...rest}
disabled={mergedDisabled}
allowClear={mergedAllowClear}
className={classNames(className, rootClassName)}
classes={{
affixWrapper: classNames(
`${prefixCls}-textarea-affix-wrapper`,
Expand Down
4 changes: 4 additions & 0 deletions components/input/__tests__/demo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ rootPropsTest(
rootPropsTest('input', (Input, props) => <Input.Password {...props} />, {
name: 'password',
});

rootPropsTest('input', (Input, props) => <Input.TextArea {...props} />, {
name: 'textarea',
});

0 comments on commit dcba47b

Please sign in to comment.