Closed Enyium closed 1 month ago
Could you present us with any evidence that suggests this should be the case? All the spin boxes / buttons I've seen so far align to the left. Here are some examples:
Just because you said all spin boxes you've seen were left-aligned: centered, centered, right-aligned, right-aligned (also follow-up pages in the left tree), right-aligned, right-aligned.
Specifically for spin boxes, especially when press-and-hold functionality is implemented, the number can easily jump when the text is left-aligned and the number of digits changes.
But you're right, when you do a Google image search for "spin box" or "ui with number text box", most of the widgets use left-aligned text.
There's a dedicated question on ux.stackexchange.com: "Why aren't HTML5 typed number inputs right aligned, and should they be?" TL;DR: It depends on the context what alignment is to be used.
So, the question is: What is the more sensible default? However you do it, there'll always be cases where an app wants it the other way. You could argue that desktop software (and embedded?) is more likely to present an unchanging, tweaking-oriented, repeatedly visited UI, while web apps are diverse, numerous, and more quickly left behind, and that this justifies right-aligning by default in the first case.
Our default widget follow the platform guidelines. For example, the cosmic style has it centered: https://releases.slint.dev/1.7.2/demos/gallery/?style=cosmic
It should not be the default for line edit with number unless it is in the design of that platform.
LineEdit already has a horizontal-alignment property you can use. And you can make your own SpinBox if you need to.
SpinBox
as well asLineEdit
withinput-type
number
ordecimal
should right-align their presented numbers by default.