Skip to content

Theme Type: Number

Robert McIntosh edited this page Sep 18, 2022 · 2 revisions

Overview

The number type allows you to define a css variable as a number. The control allows for you to limit the range the number can be from a minimum to maximum values along with a step value for how much the control increases/decreases per step. The value can also have a suffix, such as px, rem, em, etc.

image


Defining your Setting

name

A short user-friendly title that gives the user an idea of this setting. This value is localized.


hint

A long user-friendly description that details what this setting is used for. This value is localized.


type

Set type to number to generate this control.


default

The default value you would like this control to use. This value can be an integer or a float with an included suffix.

Examples of default numbers

"default": 300
"default": 0.5
"default": "300px"
"default": "0.875rem"

metadata

This field allows you to pass in optional values for customizing your settings. These settings will adjust the functionality and display of the number control. The metadata field for the number control allows setting the following values:

min

This property sets the minimum allowed value for the input selection. If no value is provided, it assumes the minimum value is 0.

max

This property sets the maximum allowed value for the input selection. If no value is provided, it assumes the maximum value is 3 times the default value.

step

This property specifies the interval between legal numbers for this control.

suffix

This property displays a suffix at the end of the number. If default contains a suffix, that will be assumed. If left blank than no suffix will be used


Example Setting

"--sidebar-width": {
	"name": "lib-themer.--sidebar-width.name",
	"hint": "lib-themer.--sidebar-width.hint",
	"type": "number",
	"default": "300px",
	"range": {
		"min": 50,
		"max": 600,
		"step": 1
	}
}