Skip to content

Latest commit

 

History

History
270 lines (167 loc) · 8.18 KB

_pages_number_setting_d_.numbersetting.md

File metadata and controls

270 lines (167 loc) · 8.18 KB

ReferenceSmartAppPageSectionNumberSetting

NumberSetting

A number setting creates an input box with a numeric keypad or slider control. The following code will create an input box with numeric keypad:

section.numberSetting("delayPeriodSeconds")
    .min(10)
    .max(3600)

To render a slider control instead:

section.numberSetting("colorTemperature")
    .min(2800).max(9000)
    .step(100)
    .style('SLIDER')

Methods

defaultValue

defaultValue(value: string | number): NumberSetting

Inherited from SectionSetting.defaultValue

Sets the initial value displayed in the setting when first shown to the user.

Parameters:

Name Type
value string | number

Returns: NumberSetting


description

description(value: string): NumberSetting

Inherited from SectionSetting.description

Sets value displayed in the setting control. Defaults to 'Tap to Set' for most types of settings.

Parameters:

Name Type
value string

Returns: NumberSetting


disabled

disabled(value: boolean): NumberSetting

Inherited from SectionSetting.disabled

Disables the ability to use the control

Parameters:

Name Type
value boolean

Returns: NumberSetting


image

image(source: string): NumberSetting

Specify an image URL to display with this setting

Parameters:

Name Type Description
source string HTTPS url or Base64-encoded data URI. Max length 2048 characters.

Returns: NumberSetting


max

max(value: number): NumberSetting

The maximum inclusive value the value can be set to.

Parameters:

Name Type
value number

Returns: NumberSetting


min

min(value: number): NumberSetting

The minimum inclusive value the decimal can be set to.

Parameters:

Name Type
value number

Returns: NumberSetting


name

name(value: string): NumberSetting

Inherited from SectionSetting.name

Sets the name of this setting. Used to reference the setting value during the processing of events. Also used as part of the i18n key for translating the displayed name and description of the setting. All settings on a page must have unique names.

Parameters:

Name Type
value string

Returns: NumberSetting


postMessage

postMessage(value: string): NumberSetting

A string to be shown after the text input field. One common use for this field is to specify a unit of measure. Omitting the value and calling postMessage() will set the value to the default i18n string, allowing translations to be defines in the locale file in the usual way.

Parameters:

Name Type Description
value string Max length 10 characters

Returns: NumberSetting


required

required(value: boolean): NumberSetting

Inherited from SectionSetting.required

Specifies that the control must be set in order to save the configuration page

Parameters:

Name Type
value boolean

Returns: NumberSetting


step

step(value: number): NumberSetting

The step between values. If the style is not set to slider then setting a step will cause up and down arrows to appear next to the input box that increment or decrement the value by the value of the step.

Parameters:

Name Type
value number

Returns: NumberSetting


style

style(value: NumberStyle): NumberSetting

Sets the style of the control. The default is a keypad input box.

Parameters:

Name Type Description
value NumberStyle

Returns: NumberSetting


submitOnChange

submitOnChange(value: boolean): NumberSetting

Inherited from SectionSetting.submitOnChange

Causes the page to be submitted and re-rendered any time the value of the setting is changed, rather than requiring the user to tap Next or Done. This behavior is useful when the the presence or enabled/disabled status of some settings depend on the value of other settings.

Parameters:

Name Type
value boolean

Returns: NumberSetting


translateDefaultValue

translateDefaultValue(value: string): NumberSetting

Inherited from SectionSetting.translateDefaultValue

Sets the initial value of the setting by passing the specified value through the i18n translation process. You might want to use translatedDefaultValue rather than defaultValue in a case like setting the default value of a text setting to the word "Kitchen" in the language of the user. defaultValue('Kitchen') will set the value "Kitchen" regardless of the user's language or whether there were localization file entries for the key "Kitchen". However, translateDefaultValue('Kitchen') will look for a localization file entry with the key "Kitchen" and set the default to that value.

Parameters:

Name Type
value string

Returns: NumberSetting