diff --git a/docusaurus/docs/React/components/contexts/message-input-context.mdx b/docusaurus/docs/React/components/contexts/message-input-context.mdx index 3d44caddb..d12f1bb02 100644 --- a/docusaurus/docs/React/components/contexts/message-input-context.mdx +++ b/docusaurus/docs/React/components/contexts/message-input-context.mdx @@ -350,6 +350,14 @@ If provided, the existing message will be edited on submit. | ------ | | object | +### minRows + +Min number of rows the underlying `textarea` will start with. The [`grow`](./#grow) on MessageInput prop has to be enabled for `minRows` to take effect. + +| Type | Default | +| ------ | ------- | +| number | 1 | + ### noFiles If true, disables file uploads for all attachments except for those with type 'image'. diff --git a/docusaurus/docs/React/components/message-input-components/message-input.mdx b/docusaurus/docs/React/components/message-input-components/message-input.mdx index 3dfebe3b7..242b21eca 100644 --- a/docusaurus/docs/React/components/message-input-components/message-input.mdx +++ b/docusaurus/docs/React/components/message-input-components/message-input.mdx @@ -128,7 +128,7 @@ If true, expands the text input vertically for new lines. Allows to hide MessageInput's send button. Used by `MessageSimple` to hide the send button in `EditMessageForm`. | Type | Default | -|---------|---------| +| ------- | ------- | | boolean | false | ### Input @@ -171,6 +171,14 @@ If provided, the existing message will be edited on submit. | ------ | | object | +### minRows + +Min number of rows the underlying `textarea` will start with. The [`grow`](./#grow) on MessageInput prop has to be enabled for `minRows` to take effect. + +| Type | Default | +| ------ | ------- | +| number | 1 | + ### noFiles If true, disables file uploads for all attachments except for those with type 'image'. diff --git a/src/components/ChatAutoComplete/ChatAutoComplete.tsx b/src/components/ChatAutoComplete/ChatAutoComplete.tsx index 8b938782e..954ce7213 100644 --- a/src/components/ChatAutoComplete/ChatAutoComplete.tsx +++ b/src/components/ChatAutoComplete/ChatAutoComplete.tsx @@ -181,6 +181,7 @@ const UnMemoizedChatAutoComplete = < loadingComponent={LoadingIndicator} maxRows={messageInput.maxRows} minChar={0} + minRows={messageInput.minRows} onBlur={props.onBlur} onChange={props.onChange || messageInput.handleChange} onFocus={props.onFocus} diff --git a/src/components/MessageInput/MessageInput.tsx b/src/components/MessageInput/MessageInput.tsx index 5326fb8c8..7c5bd250b 100644 --- a/src/components/MessageInput/MessageInput.tsx +++ b/src/components/MessageInput/MessageInput.tsx @@ -94,6 +94,8 @@ export type MessageInputProps< mentionQueryParams?: SearchQueryParams['userFilters']; /** If provided, the existing message will be edited on submit */ message?: StreamMessage; + /** Min number of rows the underlying `textarea` will start with. The `grow` on MessageInput prop has to be enabled for `minRows` to take effect. */ + minRows?: number; /** If true, disables file uploads for all attachments except for those with type 'image'. Default: false */ noFiles?: boolean; /** Function to override the default submit handler */ diff --git a/src/components/MessageInput/hooks/useCreateMessageInputContext.ts b/src/components/MessageInput/hooks/useCreateMessageInputContext.ts index 4ed44f461..4fb207c36 100644 --- a/src/components/MessageInput/hooks/useCreateMessageInputContext.ts +++ b/src/components/MessageInput/hooks/useCreateMessageInputContext.ts @@ -47,6 +47,7 @@ export const useCreateMessageInputContext = < mentioned_users, mentionQueryParams, message, + minRows, noFiles, numberOfUploads, onPaste, @@ -127,6 +128,7 @@ export const useCreateMessageInputContext = < mentioned_users, mentionQueryParams, message, + minRows, noFiles, numberOfUploads, onPaste, @@ -172,6 +174,7 @@ export const useCreateMessageInputContext = < isUploadEnabled, linkPreviewsValue, mentionedUsersLength, + minRows, parentId, publishTypingEvent, recordingController,