Skip to content

Numeric

TypeDescriptionStored as
numberNumeric input with min/max/stepint or float
rangeSlider with tooltipint or float
ArgDefaultNotes
min—Minimum allowed value.
max—Maximum allowed value.
step1Increment between valid values. Set to 0.1, 0.01, etc. for decimals.
unit''Suffix shown next to the value (e.g. 'px', '%'). Visual only — not stored.
[
'id' => 'cache_ttl',
'type' => 'number',
'label' => __('Cache TTL', 'my-plugin'),
'default' => 3600,
'columns' => 6,
'args' => [
'min' => 0,
'max' => 86_400,
'step' => 60,
'unit' => 'seconds',
],
],
[
'id' => 'preview_size',
'type' => 'range',
'label' => __('Preview size', 'my-plugin'),
'default' => 50,
'args' => [
'min' => 10,
'max' => 100,
'step' => 5,
'unit' => '%',
],
],

Stored value is an int when args.integer is truthy, otherwise a float. Values are clamped to min / max on save.