question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement cc-input-number

See original GitHub issue

Context

We need an <input type=number> with -/+ buttons. We won’t be using the existing <cc-input-text> because it already does a lot of things and they’re not really useful for input number.

Requirements

-----------------
| - |    10 | + |
-----------------
  • Needs to look like <cc-input-text> (same borders, spacing…)
  • <input type=number> under the hood
  • Text aligned to the right by default (we may consider a CSS custom prop)
  • We need to hide the arrow keys that some browser display for such fields
  • (-) minus button on the left of the field
  • (+) plus button on the right of the field

Inputs (props)

  • label
  • value
  • min
  • max
  • step
  • readonly
  • disabled

Outputs (events)

  • value

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Galimedecommented, Mar 17, 2021

I just did a few tests and it seems like step is related to min (even when it’s not set) so if you set a step of 10, it’s relative to min (default to 9) and not to current value.

Will investigate and give it the native behavior logic for the controls as it’s the case causing trouble 👍

Can you try both (red focus ring + warning icon) and post screenshots (with and without buttons in the case of the warning icon)?

Will do, I will comment with some screenshots when it’s ready 😉

Have you tried Android only? Maybe it’s for old versions…

I have also tried it on IPad, it’s the larger version of the number keyboard, will do some more tests tho 🤓

I’m considering aligning the content at the center. Could we do right aligned by default et provide a --cc-input-number-align custom property?

Sure 😄

0reactions
hsablonnierecommented, Mar 17, 2021

I’m considering aligning the content at the center. Could we do right aligned by default et provide a --cc-input-number-align custom property?

Read more comments on GitHub >

github_iconTop Results From Across the Web

<input type="number"> - HTML: HyperText Markup Language
<input> elements of type number are used to let the user enter a number. They include built-in validation to reject non-numerical entries.
Read more >
HTML input type="number"
The <input type="number"> defines a field for entering a number. Use the following attributes to specify restrictions: max - specifies the maximum value...
Read more >
Only numbers. Input number in React - javascript
I came up with a better solution. Use type='tel' along with a pattern regex within the input component itself. The nuts and bolts...
Read more >
How to force Input field to enter numbers only using ...
Now forcing input field type=”text” to accept numeric values only by using Javascript or jQuery. You can also set type=”tel” attribute in the ......
Read more >
Number input type | Can I use... Support tables for HTML5, ...
"Can I use" provides up-to-date browser support tables for support of front-end web technologies ... Number input type. - LS. Form field type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found