Skip to content

feat(VNumberInput): show error state when out of range#21825

Merged
J-Sek merged 2 commits intovuetifyjs:devfrom
J-Sek:fix/vnumberinput-error-state
Oct 8, 2025
Merged

feat(VNumberInput): show error state when out of range#21825
J-Sek merged 2 commits intovuetifyjs:devfrom
J-Sek:fix/vnumberinput-error-state

Conversation

@J-Sek
Copy link
Copy Markdown
Contributor

@J-Sek J-Sek commented Jul 26, 2025

Description:

It is not obvious when typing the value and it gets out of range. There is also no indication of a problem when min and max change and the value does not fit in between - forcing developers to always add rules.

Note: "error" state will only trigger when typing, changing the range or updating model-value with delay. Auto-clamp on mount will be dropped in 4.0.0 to respect the initial value (except enforcing precision, as it is useful to prevent JS quirks)

Markup:

<template>
  <v-app>
    <v-container>
      <v-card class="mx-auto pa-6 my-4" style="max-width: 900px">
        <v-row>
          <v-col cols="4">
            <v-number-input v-model="model.min" label="Min" />
          </v-col>
          <v-col cols="4">
            <v-number-input v-model="model.value" label="Value" :min="model.min" :max="model.max" />
          </v-col>
          <v-col cols="4">
            <v-number-input v-model="model.max" label="Max" />
          </v-col>
        </v-row>
        <small>Note: currently "error" state only triggers when typing or changing the range</small>
        <br />
        <small>In v4: we will drop auto-clamp onMounted</small>
      </v-card>
    </v-container>
  </v-app>
</template>

<script setup lang="ts">
  import { reactive } from 'vue'

  const model = reactive({ min: 0, value: 12, max: 10 })
</script>

@J-Sek J-Sek self-assigned this Jul 26, 2025
@J-Sek J-Sek force-pushed the fix/vnumberinput-error-state branch from 8a1fedb to 7cbdff6 Compare July 27, 2025 00:38
@J-Sek J-Sek added this to the v3.10.0 milestone Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants