NumberPicker
Description
The NumberPicker component is a numeric input control that leverages the native HTML number input field. It provides a fluent API to configure properties such as minimum, maximum, and step values. As part of the Tesserae Components group, it is ideal for scenarios where users need to select or input a numerical value. In addition, it supports text formatting features and style customizations like background and foreground colors.
Usage
Instantiate a NumberPicker using the Tesserae.UI helper method. You can create a default NumberPicker or initialize it with a starting value, and then chain configuration methods to set properties like minimum, maximum, or step values.
API reference
public class NumberPicker : Input<NumberPicker>, ITextFormating, IHasBackgroundColor, IHasForegroundColor, IBindableComponent<int>A form input for entering a numeric value, with optional min/max bounds and step.
- Namespace
- Tesserae
- Inheritance
- Input<NumberPicker> → NumberPicker
- Implements
- ITextFormating, IHasBackgroundColor, IHasForegroundColor, IBindableComponent<int>
Constructors
| Name | Description |
|---|---|
| NumberPicker | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| Value | Gets or sets the current value of the component. |
| Max | Gets or sets the maximum value accepted by the component. |
| Min | Gets or sets the minimum value accepted by the component. |
| Step | Gets or sets the step increment used by the component. |
| Size | Gets or sets the size of the component. |
| Weight | Gets or sets the font weight of the component. |
| TextAlign | Gets or sets the text alignment of the component. |
| Background | Gets or sets the CSS background of the component. |
| Foreground | Gets or sets the CSS color (foreground) of the component. |
public int Max { get ; set ; }Gets or sets the maximum value accepted by the component.
public int Min { get ; set ; }Gets or sets the minimum value accepted by the component.
public int Step { get ; set ; }Gets or sets the step increment used by the component.
public TextSize Size { get ; set ; }Gets or sets the size of the component.
public TextWeight Weight { get ; set ; }Gets or sets the font weight of the component.
public TextAlign TextAlign { get ; set ; }Gets or sets the text alignment of the component.
public string Background { get ; set ; }Gets or sets the CSS background of the component.
Methods
| Name | Description |
|---|---|
| AsObservable | Returns an observable that tracks the numeric value of the component. |
| SetBoundValue | Programmatically updates the numeric value as part of a two-way binding. |
| SetMax | Sets the max of the component. |
| SetMin | Sets the min of the component. |
| SetStep | Sets the step of the component. |
IObservable<int> IObservableComponent<int>.AsObservable()Returns an observable that tracks the numeric value of the component.
Remarks
NumberPicker inherits a string observable from Input{TInput}, accessible via the inherited AsObservable() method. This explicit interface implementation provides an additional IObservable<int> view used when binding to a SettableObservable<int>.
void IBindableComponent<int>.SetBoundValue(int value)Programmatically updates the numeric value as part of a two-way binding.
Samples
Basic NumberPicker Configurations
The following sample demonstrates different configurations of the NumberPicker, including default initial values, step increments, minimum and maximum constraints, and the disabled/required states.