Skip to main content

Range

Type: range

Description

Range slider for selecting numeric values within a range.

Screenshot

Range

Basic Usage

[
"type" => "range",
"heading" => __("Field Label", "your-text-domain"),
"param_name" => "your_param_name",
"description" => __("Field description", "your-text-domain"),
]

Common Parameters

All param types support these common parameters:

ParameterTypeDescription
typeStringRequired. Must be "range"
holderStringHTML tag name where the value is displayed in backend edit mode. Default: hidden input
classStringCSS class added to the holder HTML tag
headingStringLabel shown in the editor interface
param_nameStringRequired. Parameter name used in shortcode
valueMixedValue for the parameter
descriptionStringHelp text shown below the field
groupStringTab/group name to organize parameters
sectionStringSection slug to visually group params within a tab
weightIntegerDisplay order (higher = shows first)
edit_field_classStringCSS class for field width (e.g., "vc_col-sm-6")
dependencyArrayShow/hide based on other field values
admin_labelBooleanShow value in element title bar
param_holder_classStringCSS class for the param wrapper in the edit element modal
save_alwaysBooleanForce saving the value even if it equals the default or is empty
callbackArrayJavaScript function callback (e.g., ['after_add' => 'myCallback'])
settingsArrayType-specific configuration options (see Type-Specific Parameters below)
deprecatedStringVersion in which the param was deprecated

Type-Specific Parameters

ParameterTypeDefaultDescription
settingsArray-Configuration array with the following options:
    minInteger-Minimum allowed value
    maxInteger-Maximum allowed value
    stepInteger-Step increment value
    placeholderInteger-Placeholder value shown when empty
    unitString-Unit label displayed next to the input (e.g., '%', 'px'). This is a display-only label and does not modify the saved value

Complete Example

<?php
add_action('vc_before_init', 'my_element_with_range');
function my_element_with_range() {
vc_map([
"name" => __("My Element", "domain"),
"base" => "my_element",
"category" => __("My Category", "domain"),
"params" => [
[
"type" => "range",
"heading" => __("Opacity", "domain"),
"param_name" => "opacity",
"description" => __("Set element opacity", "domain"),
"settings" => [
"min" => 0,
"max" => 100,
"step" => 1,
],
],
[
"type" => "range",
"heading" => __("Width", "domain"),
"param_name" => "width",
"value" => "100",
"description" => __("Set element width", "domain"),
"settings" => [
"min" => 10,
"max" => 100,
"step" => 10,
"unit" => '%',
],
],
],
]);
}