Skip to content
IndexRequest a UIAboutContact

Button Size and Density Scale

Button sizes in three densities, with an overlay showing the 44 px touch target.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI specimen sheet of buttons in three sizes small, medium and large, each shown with a label and an icon-only variant, a dashed 44 pixel square outline around each button to show the touch target with small height annotations 32, 40 and 48 pixels, spacing arrows between buttons, light theme, flat modern style, neutral dark buttons. Negative: gradients, heavy shadows, clutter, text errors. Reduced motion: static sheet.

About this pattern

Definition

Button size is a system of height, padding and font size that scales together. Compact density suits dense desktop tools, comfortable suits touch. The visible button can be small if the clickable area is still at least about 44 pixels, which you can achieve with padding or a larger hit area.

Purpose & UX principles

  • Define three sizes with heights such as 32, 40 and 48 and keep the text-to-padding ratio.
  • Use density to scale spacing between buttons too, not only their height.
  • On touch devices keep targets at least 44 by 44 CSS pixels; add a pseudo-element hit area if the visual is smaller.
  • Keep labels at 14 pixels or larger for readability.

Interaction states

  • Density buttons and a Show touch targets switch.

Motion specification

  • Sizes change instantly.
  • Reduced motion: nothing animates.

Responsive behaviour

  • Targets that are too close cause accidental taps; leave at least 8 pixels between them.
  • Do not shrink buttons below the minimum just to fit more on screen.

Code

HTML
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Density"><button data-p="0" aria-pressed="true">Compact</button><button data-p="1" aria-pressed="false">Default</button><button data-p="2" aria-pressed="false">Comfortable</button></div><div class="rw3" id="rw3"><button class="b" type="button"><span>Small</span></button><button class="b m" type="button"><span>Medium</span></button><button class="b l" type="button"><span>Large</span></button><button class="b ib" type="button" aria-label="Add">+</button></div><label class="sw"><input id="tt" type="checkbox"> Show 44 px touch targets</label><p class="out" id="out"></p></div>

Related patterns

Primary & Secondary Button

↗
Primary & Secondary ButtonButtons & Actions

Icon Button

↗
Icon ButtonButtons & Actions

Press Feedback

↗
Press FeedbackButtons & Actions