Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

👆 style: Thumb-Sized Send Button on Touch Devices (#15979)

lia-by-librechat[bot]0da30ed479aa
diff --git a/client/src/components/Chat/Input/DuringRunSendButton.tsx b/client/src/components/Chat/Input/DuringRunSendButton.tsx
index ea84300e75..0d0902e385 100644
--- a/client/src/components/Chat/Input/DuringRunSendButton.tsx
+++ b/client/src/components/Chat/Input/DuringRunSendButton.tsx
@@ -1,8 +1,8 @@
import React, { forwardRef, useMemo } from 'react';
import { useRecoilValue } from 'recoil';
import { useWatch } from 'react-hook-form';
-import { SendActions, SendIcon } from '@librechat/client';
import { Zap, Clock, OctagonPause, ZapOff } from 'lucide-react';
+import { composerSubmitClasses, SendActions, SendIcon } from '@librechat/client';
import type { SendAction } from '@librechat/client';
import type { Control } from 'react-hook-form';
import type { ComposerKeyContext, KeyChordSource } from '~/utils/shortcuts';
@@ -10,7 +10,6 @@ import type { SteeringControls } from '~/hooks/Chat/useSteering';
import { isMacPlatform, resolveComposerKeyDown } from '~/utils/shortcuts';
import useComposerBindings from '~/hooks/Input/useComposerBindings';
import { useLocalize } from '~/hooks';
-import { cn } from '~/utils';
import store from '~/store';
/** The rows, the popover and the chord chips are shared with every other chat
@@ -175,9 +174,7 @@ const DuringRunSendButton = React.memo(
aria-label={label}
id="during-run-send-button"
disabled={!content || props.disabled === true}
- className={cn(
- 'size-theme-control rounded-theme-control-round bg-text-primary p-theme-compact text-text-primary outline-offset-4 transition-all duration-theme-normal disabled:cursor-not-allowed disabled:text-text-secondary disabled:opacity-10',
- )}
+ className={composerSubmitClasses()}
data-testid="during-run-send-button"
data-during-run-action={primary}
type="submit"
diff --git a/client/src/components/Chat/Input/SendButton.tsx b/client/src/components/Chat/Input/SendButton.tsx
index f4c855d853..5f286840bb 100644
--- a/client/src/components/Chat/Input/SendButton.tsx
+++ b/client/src/components/Chat/Input/SendButton.tsx
@@ -1,8 +1,8 @@
import React, { forwardRef } from 'react';
import { useWatch } from 'react-hook-form';
-import { SendIcon, TooltipAnchor } from '@librechat/client';
+import { composerSubmitClasses, SendIcon, TooltipAnchor } from '@librechat/client';
import type { Control } from 'react-hook-form';
-import { cn, isSubmittableMessage } from '~/utils';
+import { isSubmittableMessage } from '~/utils';
import { useLocalize } from '~/hooks';
type SendButtonProps = {
@@ -24,9 +24,7 @@ const SubmitButton = React.memo(
aria-label={localize('com_nav_send_message')}
id="send-button"
disabled={props.disabled}
- className={cn(
- 'size-theme-control rounded-theme-control-round bg-text-primary p-theme-compact text-text-primary outline-offset-4 transition-all duration-theme-normal disabled:cursor-not-allowed disabled:text-text-secondary disabled:opacity-10',
- )}
+ className={composerSubmitClasses()}
data-testid="send-button"
type="submit"
>
diff --git a/client/src/components/Chat/Input/StopButton.tsx b/client/src/components/Chat/Input/StopButton.tsx
index 2984544448..b3556f7e69 100644
--- a/client/src/components/Chat/Input/StopButton.tsx
+++ b/client/src/components/Chat/Input/StopButton.tsx
@@ -1,7 +1,6 @@
import { memo } from 'react';
-import { TooltipAnchor } from '@librechat/client';
+import { composerSubmitClasses, TooltipAnchor } from '@librechat/client';
import { useLocalize } from '~/hooks';
-import { cn } from '~/utils';
export default memo(function StopButton({
stop,
@@ -19,9 +18,7 @@ export default memo(function StopButton({
<button
type="button"
data-testid="stop-generation-button"
- className={cn(
- 'size-theme-control rounded-theme-control-round bg-text-primary p-theme-compact text-text-primary outline-offset-4 transition-all duration-theme-normal disabled:cursor-not-allowed disabled:text-text-secondary disabled:opacity-10',
- )}
+ className={composerSubmitClasses()}
aria-label={localize('com_nav_stop_generating')}
onClick={(e) => {
setShowStopButton(false);
diff --git a/client/src/components/Chat/Input/__tests__/appearanceTokens.spec.ts b/client/src/components/Chat/Input/__tests__/appearanceTokens.spec.ts
index 4e9aa1379c..f6c54294df 100644
--- a/client/src/components/Chat/Input/__tests__/appearanceTokens.spec.ts
+++ b/client/src/components/Chat/Input/__tests__/appearanceTokens.spec.ts
@@ -5,12 +5,13 @@ const inputRoot = join(__dirname, '..');
const source = (file: string): string => readFileSync(join(inputRoot, file), 'utf8');
const themedControls = [
- ['SendButton.tsx', ['size-theme-control', 'rounded-theme-control-round', 'p-theme-compact']],
- ['StopButton.tsx', ['size-theme-control', 'rounded-theme-control-round', 'p-theme-compact']],
- [
- 'DuringRunSendButton.tsx',
- ['size-theme-control', 'rounded-theme-control-round', 'p-theme-compact'],
- ],
+ /** The submit slot's three faces share one recipe, which owns the coarse-pointer
+ * tap-target floor as well as the geometry; its tokens are asserted where it
+ * lives (`composer.spec.ts`). Copying the class string back into any of them
+ * would take that floor off a phone silently, so the recipe is what is checked. */
+ ['SendButton.tsx', ['composerSubmitClasses()']],
+ ['StopButton.tsx', ['composerSubmitClasses()']],
+ ['DuringRunSendButton.tsx', ['composerSubmitClasses()']],
['InterruptSteerButton.tsx', ['size-theme-control', 'rounded-theme-control-round']],
['AudioRecorder.tsx', ['size="theme"', 'shape="theme"']],
/** Controls that draw their shape from `composerControlClasses()` prove it by
diff --git a/packages/client/src/components/Composer.tsx b/packages/client/src/components/Composer.tsx
index da1427ced6..46a303ddc7 100644
--- a/packages/client/src/components/Composer.tsx
+++ b/packages/client/src/components/Composer.tsx
@@ -7,7 +7,11 @@ import type {
RefAttributes,
} from 'react';
import type { SendAction } from './SendActions';
-import { composerSurfaceClasses, composerSurfaceShadow } from '~/utils/composer';
+import {
+ composerSubmitClasses,
+ composerSurfaceClasses,
+ composerSurfaceShadow,
+} from '~/utils/composer';
import { TextareaAutosize } from './TextareaAutosize';
import { SendActions } from './SendActions';
import { TooltipAnchor } from './Tooltip';
@@ -82,8 +86,7 @@ export type ComposerStopProps =
export type ComposerPropsWithStop = ComposerProps & ComposerStopProps;
/** Main chat's send/stop button shape, shared by both states of the slot. */
-const CONTROL_CLASS =
- 'size-theme-control rounded-theme-control-round bg-text-primary p-theme-compact text-text-primary outline-offset-4 transition-all duration-theme-normal disabled:cursor-not-allowed disabled:text-text-secondary disabled:opacity-10';
+const CONTROL_CLASS = composerSubmitClasses();
/**
* The chat composer at panel scale: one persistent surface with a text field, a
diff --git a/packages/client/src/theme/tailwind.spec.js b/packages/client/src/theme/tailwind.spec.js
index 695972ad0e..741d381e10 100644
--- a/packages/client/src/theme/tailwind.spec.js
+++ b/packages/client/src/theme/tailwind.spec.js
@@ -27,6 +27,9 @@ describe('LibreChat Tailwind preset', () => {
expect(resolved.theme.spacing['theme-control']).toBe(
`var(--theme-control-height, ${defaultAppearance.controlHeight})`,
);
+ expect(resolved.theme.spacing['theme-control-touch']).toBe(
+ `max(var(--theme-control-height, ${defaultAppearance.controlHeight}), 2.75rem)`,
+ );
expect(resolved.theme.borderRadius['theme-control']).toBe(
`var(--theme-control-radius, ${defaultAppearance.controlRadius})`,
);
@@ -50,6 +53,24 @@ describe('LibreChat Tailwind preset', () => {
);
});
+ /** The tap-target floor is half CSS and half variant: a spacing key nothing can
+ * reach is not a floor, so the registration is asserted, not just the value. */
+ it('registers the appearance variants the utilities are written against', () => {
+ const variants = {};
+ tailwindPreset.plugins.forEach((plugin) =>
+ plugin({
+ addVariant: (name, value) => {
+ variants[name] = value;
+ },
+ }),
+ );
+
+ /** `any-pointer`, not `pointer`: the floor has to apply to a 2-in-1's
+ * touchscreen while its trackpad is the primary device and reports `fine`. */
+ expect(variants.touch).toBe('@media (any-pointer: coarse)');
+ expect(variants['high-contrast']).toBe('html.high-contrast &');
+ });
+
it('exposes the preset in the published package', () => {
expect(packageJson.files).toContain('tailwind.preset.cjs');
expect(packageJson.exports['./tailwind-preset']).toBe('./tailwind.preset.cjs');
diff --git a/packages/client/src/utils/composer.spec.ts b/packages/client/src/utils/composer.spec.ts
index f69ed6b29d..5bbe828512 100644
--- a/packages/client/src/utils/composer.spec.ts
+++ b/packages/client/src/utils/composer.spec.ts
@@ -1,4 +1,4 @@
-import { composerControlClasses, composerSurfaceClasses } from './composer';
+import { composerControlClasses, composerSubmitClasses, composerSurfaceClasses } from './composer';
describe('composerSurfaceClasses', () => {
it('draws the composer surface from semantic roles', () => {
@@ -10,6 +10,32 @@ describe('composerSurfaceClasses', () => {
});
});
+describe('composerSubmitClasses', () => {
+ it('owns the send/stop geometry from the shared tokens', () => {
+ const classes = composerSubmitClasses();
+
+ expect(classes).toContain('size-theme-control');
+ expect(classes).toContain('rounded-theme-control-round');
+ expect(classes).toContain('p-theme-compact');
+ });
+
+ it('floors the tap target wherever touch is reachable, and centers the icon', () => {
+ const classes = composerSubmitClasses();
+
+ expect(classes).toContain('touch:size-theme-control-touch');
+ expect(classes).toContain('items-center');
+ expect(classes).toContain('justify-center');
+ });
+
+ it('draws its fill and disabled state from semantic roles', () => {
+ const classes = composerSubmitClasses();
+
+ expect(classes).toContain('bg-text-primary');
+ expect(classes).toContain('disabled:text-text-secondary');
+ expect(classes).not.toMatch(/#[0-9a-f]{3,6}|rgb\(|hsl\(/i);
+ });
+});
+
describe('composerControlClasses', () => {
it('owns the geometry every labeled composer control shares', () => {
const classes = composerControlClasses();
diff --git a/packages/client/src/utils/composer.ts b/packages/client/src/utils/composer.ts
index 9c2527758d..73f1d5ee09 100644
--- a/packages/client/src/utils/composer.ts
+++ b/packages/client/src/utils/composer.ts
@@ -18,6 +18,28 @@ export const composerSurfaceShadow = {
within: 'shadow-md focus-within:shadow-lg',
} as const;
+/**
+ * The composer's submit slot: send, stop, and the during-run send button that
+ * takes their place while a run generates. One recipe because all three swap
+ * into the same position and must be indistinguishable in everything but the
+ * icon they carry.
+ *
+ * Wherever touch is reachable it is the row's one 44px target. `size-theme-control` is
+ * 36px, which a thumb aimed at the bottom corner of a phone clips or misses
+ * outright, and below `sm` the composer surface runs to the viewport floor by
+ * design, so the target has to grow upward instead of gaining a band of padding
+ * beneath it. Centering is `flex` rather than the icon's fit inside
+ * `p-theme-compact`, which only held while the box was exactly icon-sized.
+ */
+export const composerSubmitClasses = (): string =>
+ cn(
+ 'flex items-center justify-center',
+ 'size-theme-control touch:size-theme-control-touch',
+ 'rounded-theme-control-round bg-text-primary p-theme-compact text-text-primary',
+ 'outline-offset-4 transition-all duration-theme-normal',
+ 'disabled:cursor-not-allowed disabled:text-text-secondary disabled:opacity-10',
+ );
+
/**
* Shared appearance for a labeled control in the composer's action row — the
* capability checkboxes, the MCP selector, the code-approval selector. Border,
diff --git a/packages/client/tailwind.preset.cjs b/packages/client/tailwind.preset.cjs
index 53c11d5175..71182d8335 100644
--- a/packages/client/tailwind.preset.cjs
+++ b/packages/client/tailwind.preset.cjs
@@ -12,6 +12,12 @@ module.exports = {
'theme-compact': 'var(--theme-space-compact, 0.375rem)',
'theme-normal': 'var(--theme-space-normal, 0.75rem)',
'theme-control': 'var(--theme-control-height, 2.25rem)',
+ /**
+ * The comfortable tap target (2.75rem / 44px), held against the theme's
+ * own control height with `max()` so a theme that already draws larger
+ * controls is never shrunk on a phone. Pair it with `touch:`.
+ */
+ 'theme-control-touch': 'max(var(--theme-control-height, 2.25rem), 2.75rem)',
},
borderRadius: {
'theme-control': 'var(--theme-control-radius, 0.75rem)',
@@ -48,6 +54,22 @@ module.exports = {
* `high-contrast-dark` choice as well as the OS preference.
*/
addVariant('high-contrast', 'html.high-contrast &');
+
+ /**
+ * Touch is reachable at all — `any-pointer`, deliberately not `pointer`.
+ * `pointer` describes only the PRIMARY pointing device, so a 2-in-1 driven
+ * by its trackpad reports `fine` with its touchscreen right there, and a
+ * tap-target floor written against `(pointer: coarse)` would never reach
+ * the finger it exists for.
+ *
+ * Not the query `useFocusChatEffect` and the composer's focus guard branch
+ * on, though it looks like it: those ask "would focusing raise an on-screen
+ * keyboard over the thread", which is a question about the primary input and
+ * must keep answering `fine` for the trackpad user on that same 2-in-1. A
+ * tap target asks the other question — whether a finger can reach the
+ * control at all — so the two queries differ on purpose.
+ */
+ addVariant('touch', '@media (any-pointer: coarse)');
},
],
};