Skip to content

Commit 13959aa

Browse files
prestonwebdevclaude
andcommitted
feat(ui): increase button and input height for larger touch targets
Buttons and inputs get taller by growing their default vertical padding from 6px to 7px, and to 8px on mobile (<=480px). Social provider icon buttons match the new height and their icons scale from 16px to 20px on mobile. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f42aad9 commit 13959aa

5 files changed

Lines changed: 28 additions & 4 deletions

File tree

.changeset/tall-buttons-inputs.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Increase the default height of buttons and inputs for larger, easier-to-tap touch targets, especially on mobile. Their default vertical padding grows from 6px to 7px, and to 8px on mobile (≤480px). Social provider icon buttons match the taller height, and their icons scale from 16px to 20px on mobile.

packages/ui/src/elements/SocialButtons.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ export const SocialButtons = React.memo((props: SocialButtonsRootProps) => {
195195
isLoading={card.loadingMetadata === strategy}
196196
isDisabled={card.isLoading}
197197
alt={`Sign in with ${strategyToDisplayData[strategy].name}`}
198+
// Icon-only buttons get a 16px glyph on desktop and 20px on mobile to
199+
// stay proportional to the taller button; block buttons keep 16px, which
200+
// fits their fixed icon slot.
201+
size='$4'
202+
sx={preferBlockButtons ? undefined : t => ({ [mqu.sm]: { width: t.sizes.$5, height: t.sizes.$5 } })}
198203
elementDescriptor={[descriptors.providerIcon, descriptors.socialButtonsProviderIcon]}
199204
elementId={descriptors.socialButtonsProviderIcon.setId(strategyToDisplayData[strategy].id)}
200205
/>
@@ -250,8 +255,10 @@ const SocialButtonIcon = forwardRef((props: SocialButtonProps, ref: Ref<HTMLButt
250255
colorScheme='neutral'
251256
hoverAsFocus
252257
sx={t => ({
258+
// Match the taller block/primary buttons so the icon row lines up.
253259
minHeight: t.sizes.$8,
254260
width: '100%',
261+
[mqu.sm]: { minHeight: t.sizes.$9 },
255262
})}
256263
{...rest}
257264
>

packages/ui/src/foundations/sizes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const spacingScale = Object.freeze({
1818
'0x5': { rem: '0.125rem', multiplier: 0.5 },
1919
'1': { rem: '0.25rem', multiplier: 1 },
2020
'1x5': { rem: '0.375rem', multiplier: 1.5 },
21+
'1x75': { rem: '0.4375rem', multiplier: 1.75 },
2122
'2': { rem: '0.5rem', multiplier: 2 },
2223
'2x5': { rem: '0.625rem', multiplier: 2.5 },
2324
'3': { rem: '0.75rem', multiplier: 3 },
@@ -96,6 +97,7 @@ const spaceUnits = Object.freeze({
9697
'0x5': spacingScale['0x5'].rem,
9798
'1': spacingScale['1'].rem,
9899
'1x5': spacingScale['1x5'].rem,
100+
'1x75': spacingScale['1x75'].rem,
99101
'2': spacingScale['2'].rem,
100102
'2x5': spacingScale['2x5'].rem,
101103
'3': spacingScale['3'].rem,

packages/ui/src/primitives/Button.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import { descriptors, Icon, Spinner } from '../customizables';
55
import { TriangleRight } from '../icons';
66
import type { PrimitiveProps, StyleVariants } from '../styledSystem';
7-
import { common, createCssVariables, createVariants } from '../styledSystem';
7+
import { common, createCssVariables, createVariants, mqu } from '../styledSystem';
88
import { applyDataStateProps } from './applyDataStateProps';
99
import { Flex } from './Flex';
1010

@@ -40,7 +40,12 @@ const { applyVariants, filterProps } = createVariants(
4040
padding: `${theme.space.$1} ${theme.space.$3}`,
4141
},
4242
sm: {
43-
padding: `${theme.space.$1x5} ${theme.space.$3}`,
43+
// Taller controls on mobile (8px) than desktop (7px) for easier tapping.
44+
padding: `${theme.space.$1x75} ${theme.space.$3}`,
45+
[mqu.sm]: {
46+
paddingTop: theme.space.$2,
47+
paddingBottom: theme.space.$2,
48+
},
4449
},
4550
md: {
4651
padding: `${theme.space.$2x5} ${theme.space.$5}`,

packages/ui/src/primitives/Input.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ const { applyVariants, filterProps } = createVariants((theme, props) => ({
1010
base: {
1111
boxSizing: 'border-box',
1212
margin: 0,
13-
padding: `${theme.space.$1x5} ${theme.space.$3}`,
13+
padding: `${theme.space.$1x75} ${theme.space.$3}`,
1414
backgroundColor: theme.colors.$colorInput,
1515
color: theme.colors.$colorInputForeground,
1616
// outline support for Windows contrast themes
1717
outline: 'transparent solid 2px',
1818
outlineOffset: '2px',
19-
maxHeight: theme.sizes.$9,
19+
maxHeight: theme.sizes.$10,
2020
width: props.type === 'checkbox' ? theme.sizes.$4 : '100%',
2121
accentColor: theme.colors.$primary500,
2222
...(props.type === 'checkbox'
@@ -35,6 +35,11 @@ const { applyVariants, filterProps } = createVariants((theme, props) => ({
3535
: {}),
3636
...common.textVariants(theme).body,
3737
...common.disabled(theme),
38+
// Taller inputs on mobile (8px) than desktop (7px) for easier tapping.
39+
[mqu.sm]: {
40+
paddingTop: theme.space.$2,
41+
paddingBottom: theme.space.$2,
42+
},
3843
// This is a workaround to prevent zooming on iOS when focusing an input
3944
[mqu.ios]: {
4045
fontSize: theme.fontSizes.$lg,

0 commit comments

Comments
 (0)