Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VField/VInput): centerAffix doesn't work for underlined/plain #20064

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Jun 27, 2024

Automatically apply singleLine under the hood, and vertically align appendInner, prependInner, clearIcon, label and input field in the center.

Description

Markup:

<template>
  <v-container class="pa-md-12 bg-grey">
    <v-row>
      <v-col cols="4">
        <v-text-field
          bg-color="white"
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="solo"
          label="solo"
          variant="solo"
          center-affix
        />
        <v-text-field
          bg-color="white"
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="outlined"
          label="outlined"
          variant="outlined"
          center-affix
        />
        <v-text-field
          bg-color="white"
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="filled"
          label="filled"
          variant="filled"
          center-affix
        />
        <v-text-field
          bg-color="white"
          clearable
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="underlined"
          label="underlined"
          variant="underlined"
          center-affix
        />
      </v-col>
      <v-col cols="4">
        <v-text-field
          bg-color="white"
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="solo"
          label="solo"
          variant="solo"
        />
        <v-text-field
          bg-color="white"
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="outlined"
          label="outlined"
          variant="outlined"
        />
        <v-text-field
          bg-color="white"
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="filled"
          label="filled"
          variant="filled"
        />
        <v-text-field
          bg-color="white"
          clearable
          prepend-icon="$vuetify"
          prepend-inner-icon="$vuetify"
          placeholder="underlined"
          label="underlined"
          variant="underlined"
        />
      </v-col>
    </v-row>
  </v-container>
</template>

<script setup>
  import { ref } from 'vue'
</script>



@yuwu9145 yuwu9145 changed the title fix(VField/VInput): centerAffix doesn't work for underlined/filled Jun 27, 2024
@johnleider
Copy link
Member

Is there a collection of props that would move the label to the middle as well?
image

@yuwu9145 yuwu9145 marked this pull request as draft June 28, 2024 04:12
@yuwu9145 yuwu9145 marked this pull request as ready for review June 30, 2024 03:00
@yuwu9145
Copy link
Member Author

@johnleider See if you were satisfied with the API description/usage change, I will handle the technical part and make sure no regression

@johnleider
Copy link
Member

Looks good. Not related to anything you've done, but the prepend-inner icon is really tight on the edge of the input. Is that by design or not intentional?

@yuwu9145
Copy link
Member Author

yuwu9145 commented Jul 3, 2024

I think underlined variant is supposed to extend the content to edges, we have a little gap before prepend-inner, which is ok I guess.

Use slot to add a manual gap

Screenshot 2024-07-03 at 3 00 43 pm
<v-text-field
          bg-color="white"
          clearable
          prepend-icon="$vuetify"
          placeholder="underlined"
          label="underlined"
          variant="underlined"
          center-affix
        >
          <template #prepend-inner>
            <v-icon class="ml-3" icon="$vuetify" />
          </template>
        </v-text-field>
@johnleider johnleider added T: bug Functionality that does not work as intended/expected C: VInput VInput C: VField labels Jul 3, 2024
@johnleider johnleider added this to the v3.6.x milestone Jul 3, 2024
@@ -42,7 +42,7 @@ export const makeVInputProps = propsFactory({
appendIcon: IconValue,
centerAffix: {
type: Boolean,
default: true,
default: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If default is false, can just do centerAffix: Boolean which defaults to false.

@@ -64,7 +64,7 @@ export const makeVFieldProps = propsFactory({
active: Boolean,
centerAffix: {
type: Boolean,
default: undefined,
default: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If default is false, can just do centerAffix: Boolean which defaults to false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VField C: VInput VInput T: bug Functionality that does not work as intended/expected
2 participants