Skip to content

Commit

Permalink
fix(VCounter): add error color when max is exceeded
Browse files Browse the repository at this point in the history
fixes #19615
  • Loading branch information
KaelWD committed Apr 15, 2024
1 parent 702bb50 commit d4921d8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vuetify/src/components/VCounter/VCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type { Component } from 'vue'

export const makeVCounterProps = propsFactory({
active: Boolean,
disabled: Boolean,
max: [Number, String],
value: {
type: [Number, String],
Expand Down Expand Up @@ -57,6 +58,10 @@ export const VCounter = genericComponent<VCounterSlots>()({
v-show={ props.active }
class={[
'v-counter',
{
'text-error': props.max && !props.disabled &&
parseFloat(props.value) > parseFloat(props.max),
},
props.class,
]}
style={ props.style }
Expand Down
1 change: 1 addition & 0 deletions packages/vuetify/src/components/VFileInput/VFileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export const VFileInput = genericComponent<VFileInputSlots>()({
<VCounter
active={ !!model.value?.length }
value={ counterValue.value }
disabled={ props.disabled }
v-slots:default={ slots.counter }
/>
</>
Expand Down
1 change: 1 addition & 0 deletions packages/vuetify/src/components/VTextField/VTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export const VTextField = genericComponent<VTextFieldSlots>()({
active={ props.persistentCounter || isFocused.value }
value={ counterValue.value }
max={ max.value }
disabled={ props.disabled }
v-slots:default={ slots.counter }
/>
</>
Expand Down
1 change: 1 addition & 0 deletions packages/vuetify/src/components/VTextarea/VTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ export const VTextarea = genericComponent<VTextareaSlots>()({
active={ props.persistentCounter || isFocused.value }
value={ counterValue.value }
max={ max.value }
disabled={ props.disabled }
v-slots:default={ slots.counter }
/>
</>
Expand Down

0 comments on commit d4921d8

Please sign in to comment.