GitHubX

PasswordField

PreviousNext

A composable password input with visibility toggle and click-outside reset

      
      <script setup lang="ts">
import { PasswordField, PasswordFieldInput, PasswordFieldToggle } from "@/components/password-field";
import { ref } from "vue";

const password = ref("");
</script>

<template>
  <PasswordField v-model="password" class="w-72">
    <PasswordFieldInput />
    <PasswordFieldToggle />
  </PasswordField>
</template>
    

Features

  • Reset on click outside — Password visibility resets to hidden when clicking outside the field
  • Show/hide password — Toggle password visibility with a button

Installation

Install from the Vuzeno registry with the shadcn-vue CLI:

      
      bunx --bun shadcn-vue@latest add https://vuzeno.com/r/password-field.json
    

API

PropTypeDefaultDescription
modelValuestringThe model value of the password field
disabledbooleanfalseWhether the password field is disabled
type"text" | "password"The type of the password field (controlled)
defaultType"text" | "password""password"The default type of the password field
resetOnClickOutsidebooleantrueWhether to reset the type to password when clicking outside the field