---
title: ValidRangeDefault
description: >-
  Identifies range setting values that are outside the setting's range or not
  aligned to its step.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-range-default
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-range-default.md
api_name: liquid
---

# ValidRangeDefault

Identifies values for [`range`](https://shopify.dev/docs/storefronts/themes/architecture/settings/input-settings#range) settings that the setting can't hold. A value needs to be between the setting's `min` and `max`, inclusive, and it needs to equal `min` plus a whole number of `step` increments. If a setting doesn't have a `step`, then Theme Check uses a step of `1`. Theme Check allows for floating-point rounding, so a value of `4.7` is aligned to a `step` of `0.1` that starts at a `min` of `1`.

This check covers the following values:

* In the `{% schema %}` tag of a section or theme block, the `default` of each `range` setting, including the settings of blocks that the schema defines.
* In the same `{% schema %}` tag, the values that `presets` give the file's own `range` settings, and the values that a section's `default` gives them.
* In `config/settings_schema.json`, the `default` of each `range` setting.

Theme Check skips a `range` setting if its `min`, `max`, or `step` isn't a number, if its `step` isn't greater than `0`, or if its `max` isn't greater than its `min`.

***

## Examples

The following examples contain code snippets that either fail or pass this check.

### ✗ Fail

In the following example, `60` isn't aligned to a step of `8` that starts at `0`, so Theme Check reports `Default value 60 for range setting "padding_top" is not aligned to step 8 in range [0, 160].`:

## sections/example.liquid

```liquid
{% schema %}
{
  "name": "Example",
  "settings": [
    {
      "type": "range",
      "id": "padding_top",
      "label": "Top padding",
      "min": 0,
      "max": 160,
      "step": 8,
      "default": 60
    }
  ]
}
{% endschema %}
```

In the following example, `0` is below the setting's `min`, so Theme Check reports `Default value 0 for range setting "gap" is outside the range [10, 60].`:

## sections/example.liquid

```liquid
{% schema %}
{
  "name": "Example",
  "settings": [
    {
      "type": "range",
      "id": "gap",
      "label": "Gap",
      "min": 10,
      "max": 60,
      "step": 5,
      "default": 0
    }
  ]
}
{% endschema %}
```

In the following example, the preset gives `padding_top` a value of `60`, so Theme Check reports `Value 60 for range setting "padding_top" is not aligned to step 8 in range [0, 160].`:

## sections/example.liquid

```liquid
{% schema %}
{
  "name": "Example",
  "settings": [
    {
      "type": "range",
      "id": "padding_top",
      "label": "Top padding",
      "min": 0,
      "max": 160,
      "step": 8,
      "default": 64
    }
  ],
  "presets": [
    {
      "name": "Default",
      "settings": {
        "padding_top": 60
      }
    }
  ]
}
{% endschema %}
```

### ✓ Pass

In the following example, the default and the preset value are both between `0` and `160`, and aligned to a step of `8`:

## sections/example.liquid

```liquid
{% schema %}
{
  "name": "Example",
  "settings": [
    {
      "type": "range",
      "id": "padding_top",
      "label": "Top padding",
      "min": 0,
      "max": 160,
      "step": 8,
      "default": 64
    }
  ],
  "presets": [
    {
      "name": "Default",
      "settings": {
        "padding_top": 48
      }
    }
  ]
}
{% endschema %}
```

In the following example, the default is aligned to a step of `4` that starts at `50`:

## config/settings\_schema.json

```json
[
  {
    "name": "Layout",
    "settings": [
      {
        "type": "range",
        "id": "logo_width",
        "label": "Logo width",
        "min": 50,
        "max": 200,
        "step": 4,
        "default": 74
      }
    ]
  }
]
```

***

## Options

The following example contains the default configuration for this check:

```yaml
ValidRangeDefault:
  enabled: true
  severity: error
```

| Parameter | Description |
| - | - |
| `enabled` | Whether this check is enabled. |
| `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. |

***

## Disabling this check

Disabling this check isn't recommended.

***
