vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

feat(VOtpInput): add a bool property masked to show the text or not

Open ankusharoraa opened this issue 11 months ago • 4 comments

resolves #18964

Description

As mentioned in the issue, I have added a masked attribute that can be used with text and number type to mask the input.

Markup:

<template>
  <v-app>
    <v-container>
      <!-- -->
      <v-otp-input v-model="otp" type="text" masked />
      {{ otp }}
    </v-container>
  </v-app>
</template>

<script>
  import { ref } from 'vue';

  import { VOtpInput } from '../src/components/VOtpInput/index.ts'
  export default {
    name: 'Playground',
    components: {
      VOtpInput,
    },
    setup () {
      const otp = ref('')
      return {
        otp,
        //
      }
    },
  }
</script>

ankusharoraa avatar Jan 31 '25 16:01 ankusharoraa

@johnleider Can you please review this PR

ankusharoraa avatar Feb 01 '25 08:02 ankusharoraa

Usually this is done by the user via the type prop, switching between password/text|number. This does make it easier but for such a simple component, I'm not sure it's worth inflating it's API.

johnleider avatar Feb 06 '25 16:02 johnleider

Usually this is done by the user via the type prop, switching between password/text|number. This does make it easier but for such a simple component, I'm not sure it's worth inflating it's API.

Thanks for the feedback! As mentioned in the issue, I’ve added a masked attribute that works with both text and number types to mask the input. My intention was to provide flexibility while keeping the API simple, but I understand your concern about potentially overcomplicating it.

Can you let me know if you’re suggesting a different approach for handling this, or if you'd prefer a simpler method to manage input types and masking? I’m open to suggestions!

ankusharoraa avatar Feb 06 '25 18:02 ankusharoraa

Maybe instead of a prop we can provide an example in the docs that shows how the user can do it? With masking coming back to the framework soon, I don't want to introduce any potentially confusing API .

johnleider avatar Feb 10 '25 20:02 johnleider