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): floating label respect paddings to avoid overflow #20736

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Nov 26, 2024

Description

fixes #20734

Markup:

<template>
  <v-form>
    <v-container max-width="600">
      <v-text-field
        density="compact"
        variant="solo"
        v-model="label"
      />
      <div class="d-flex ga-3 align-center">
        rounded:
        <v-chip-group filter color="primary" v-model="rounded">
          <v-chip value="sm" text="sm" />
          <v-chip value="lg" text="lg" />
          <v-chip value="xl" text="xl" />
          <v-chip :value="true" text="true" />
          <v-chip value="pill" text="pill" />
        </v-chip-group>
      </div>
      <v-row>
        <v-col cols="12" sm="6">
          <v-text-field :label="label" model-value="asd" prepend-icon="mdi-map-marker" :rounded="rounded" />
          <v-text-field :label="label" model-value="asd" prepend-inner-icon="mdi-map-marker" :rounded="rounded" />
          <v-text-field append-icon="mdi-map-marker" :label="label" model-value="asd" :rounded="rounded" />
          <v-text-field append-inner-icon="mdi-map-marker" :label="label" model-value="asd" :rounded="rounded" />
        </v-col>

        <v-col cols="12" sm="6">
          <v-text-field :label="label" model-value="asd" prepend-icon="mdi-map-marker" variant="solo" :rounded="rounded" />
          <v-text-field :label="label" model-value="asd" prepend-inner-icon="mdi-map-marker" variant="solo" :rounded="rounded" />
          <v-text-field append-icon="mdi-map-marker" :label="label" model-value="asd" variant="solo" :rounded="rounded" />
          <v-text-field append-inner-icon="mdi-map-marker" :label="label" model-value="asd" variant="solo" :rounded="rounded" />
        </v-col>

        <v-col cols="12" sm="6">
          <v-text-field :label="label" model-value="asd" prepend-icon="mdi-map-marker" variant="outlined" :rounded="rounded" />
          <v-text-field :label="label" model-value="asd" prepend-inner-icon="mdi-map-marker" variant="outlined" :rounded="rounded" />
          <v-text-field append-icon="mdi-map-marker" :label="label" model-value="asd" variant="outlined" :rounded="rounded" />
          <v-text-field append-inner-icon="mdi-map-marker" :label="label" model-value="asd" variant="outlined" :rounded="rounded" />
        </v-col>

        <v-col cols="12" sm="6">
          <v-text-field :label="label" model-value="asd" prepend-icon="mdi-map-marker" variant="outlined" :rounded="rounded" />
          <v-text-field :label="label" model-value="asd" prepend-inner-icon="mdi-map-marker" variant="outlined" :rounded="rounded" />
          <v-text-field append-icon="mdi-map-marker" :label="label" model-value="asd" variant="outlined" :rounded="rounded" />
          <v-text-field append-inner-icon="mdi-map-marker" :label="label" model-value="asd" variant="outlined" :rounded="rounded" />
        </v-col>
      </v-row>
    </v-container>
  </v-form>
</template>

<script setup>
  import { ref } from 'vue'
  const rounded = ref(undefined)
  const label = ref('test test test test test test test test test test test test test test')
</script>

@J-Sek
Copy link
Contributor Author

J-Sek commented Nov 26, 2024

Outlined version needs some additional treatment

  • avoid cutting short labels
  • show the missing part of outline
  • (existing issue) keep right borders rounded
screenshot

image

@KaelWD KaelWD marked this pull request as draft December 3, 2024 10:21
@J-Sek J-Sek marked this pull request as ready for review January 25, 2025 00:55
@J-Sek
Copy link
Contributor Author

J-Sek commented Jan 25, 2025

A small regression was introduced in recently merged #20349, so I decided to patch it as well.

As as side-note: I don't like that rule because floating label shifts too much. It would be nice to have a new --v-field-border-radius variable so we can calculate flex-basis and max-width from the exact rounding. example

@J-Sek J-Sek requested a review from johnleider January 25, 2025 01:16
@johnleider johnleider added this to the v3.7.x milestone Jan 27, 2025
@johnleider johnleider changed the title fix(VField): floating label should respect paddings to avoid overflow fix(VField): floating label respect paddings to avoid overflow Jan 27, 2025
@johnleider johnleider merged commit 7351074 into vuetifyjs:master Jan 27, 2025
10 checks passed
@J-Sek J-Sek deleted the fix/20734 branch January 28, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.7.4] Text-field Label Text Does Not Truncate Correctly When It Exceeds Width
2 participants