Skip to content

Comments

[WIP] Add stepper input component#1719

Draft
colinrotherham wants to merge 12 commits intocomponent-button-iconfrom
component-number-input
Draft

[WIP] Add stepper input component#1719
colinrotherham wants to merge 12 commits intocomponent-button-iconfrom
component-number-input

Conversation

@colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Nov 28, 2025

Description

This PR adds a new stepper input component with +/- stepper buttons

It was built using prototype from @edwardhorsford and utilises:

To do: Add screen reader status announcements (see prototype code)

Number input with stepper buttons

Checklist

@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 November 28, 2025 13:05 Inactive
@colinrotherham
Copy link
Contributor Author

I've compared the prototype icons and they're slightly smaller than our default size

E.g. Here's the "Close" icon in red, rotated to compare with the new "Plus" icon

Icon size difference

@edwardhorsford
Copy link
Contributor

This is awesome to see @colinrotherham!

Some thoughts:

  • I reckon we should avoid numberInput - to me this implies it's a general component for numbers, when in reality it's a subset. I think stepper / stepperInput might be the more conventional name?
  • I didn't do it in my prototype, but you could conceive that it could optionally accept text to go inside each button - either alongside the icons or instead of.
  • I reckon these icons are a bit large / weighty (very subjective though)
  • In my prototype I used centred text for the input. That's probably unconventional but I felt made the component as a whole seem more balanced - would be interested in what others think.

@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 November 28, 2025 15:49 Inactive
@colinrotherham colinrotherham changed the title [WIP] Add number input component [WIP] Add stepper input component Nov 28, 2025
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 November 28, 2025 16:38 Inactive
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 November 28, 2025 21:22 Inactive
@colinrotherham colinrotherham force-pushed the component-button-icon branch 2 times, most recently from 031ffa6 to 5606c8d Compare December 1, 2025 17:50
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 December 1, 2025 17:55 Inactive
@anandamaryon1
Copy link
Contributor

Very cool and works well.

Agree with the decision to centre the number in the input, to better relate to to both stepper buttons.

Being able to use arrow keys is a nice touch, guessing that's just the underlying input type number though.

Struggle to think of many use-cases for this though, don't think we have many services where you fill a basket of items. I suppose it helps in situations where the user is primarily using a mouse and can avoid breaking flow to use the keyboard? Or on touch devices where the keyboard is a little more unwieldy?

@edwardhorsford
Copy link
Contributor

@anandamaryon1

There was a good article by Nielson Norman group about them. Agree the usages are limited. Besides the mouse/tablet only scenario, I'd see them as being most effective where users may need to make small adjustments to a value relative to a current value.

You could speculate for NHS that might be adjusting dosages - 0, 25ml, 50ml, 75ml, etc. Or 'how many times a week do you do x' type surveys. Agreed it's probably not that common though!

@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 February 9, 2026 12:53 Inactive
@colinrotherham colinrotherham force-pushed the component-button-icon branch 2 times, most recently from fa979ec to bae5e02 Compare February 9, 2026 17:24
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 February 9, 2026 17:29 Inactive
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1719 February 10, 2026 08:32 Inactive
@sonarqubecloud
Copy link

@anandamaryon1
Copy link
Contributor

A stepper in the wild: https://ukhsa-dashboard.data.gov.uk/cover/childhood-vaccinations

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants