NumberInput

com.alecdorrington.laminarcomponents.NumberInput
object NumberInput

A number typed into a field, or stepped by the arrows forming its end, which repeat while held, in place of the browser's own, which differ from browser to browser. The arrows reach the field as typing would, by input and change.

Drawn as .lc-number-input, the field within it, and its arrows .lc-number-steps in .lc-number-steps, each icon a .lc-number-arrow. The arrows' width is --lc-number-steps, which a width given the box should add to the number's room: calc(5em + var(--lc-number-steps)).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(field: Modifier[L.HtmlElement]*): L.HtmlElement

Renders a number field. The box it gives is what is laid out, shown or hidden.

Renders a number field. The box it gives is what is laid out, shown or hidden.

Value parameters

field

Modifiers of the field itself: its bounds, its step, its name (aria.label) and its binding.

Attributes

Returns

The field and its arrows.

def count(shown: Signal[Int], set: Int => Unit, most: Option[Int] = ...): Modifier[L.HtmlElement]

Binds a field to a whole count from 0 to most. Emptied, it reads as 0, so that it can be typed afresh.

Binds a field to a whole count from 0 to most. Emptied, it reads as 0, so that it can be typed afresh.

Value parameters

most

The greatest count, if any.

set

The callback given each count typed or stepped to.

shown

The count.

Attributes

Returns

The field's modifiers.

def counted(raw: String): Option[Int]

Reads a count as typed: 0 while emptied, never below 0.

Reads a count as typed: 0 while emptied, never below 0.

Value parameters

raw

The field's text.

Attributes

Returns

The count, if the text is one.

def stepped(from: String, step: String, steps: Int, low: String, high: String): String

Steps a number, within bounds, as precise as the step and the number are written. An empty or unreadable number reads as 0, as a browser's own arrows read it.

Steps a number, within bounds, as precise as the step and the number are written. An empty or unreadable number reads as 0, as a browser's own arrows read it.

Value parameters

from

The number as typed.

high

The field's greatest value, none if empty.

low

The field's least value, none if empty.

step

The field's step, 1 if empty or not positive.

steps

How many steps, down where negative.

Attributes

Returns

The number stepped to, as typed.

def written(value: Double): String

Writes a number as typed, without a decimal point when it is whole.

Writes a number as typed, without a decimal point when it is whole.

Value parameters

value

The number.

Attributes

Returns

Its text.