ViraStack
  • Akademi
  • Hakkında
  • Destek
Genel BakışBaşlangıçÖrnekler
ViraStack

Frontend ekosistemi: ücretsiz rehberler, proje şablonları, AI kuralları ve form bileşenleri.

Ürünler

  • ViraStack Start
  • ViraStack AI
  • ViraStack Mask
  • ViraStack Password
  • ViraStack Guide

Keşfet

  • Akademi
  • Hakkında
  • Marka
  • Destek

© 2026 ViraStack.

Açık kaynak · MIT

Örnekler

  • Tümü
  • Basit
  • Disabled / readOnly
  • Göster / gizle
  • Güç göstergesi
  • Kişisel bilgi
  • Mask ile kayıt
  • Özel ikonlar
  • Özel metin
  • Parola tekrarı
  • Programatik
  • Prop merge
  • React Hook Form + Zod
  • Server Action
  • Sızmış parolalar

Parola tekrarı

matchWith ile tekrar alanı; matches true, false veya null.

← Tüm örnekler·confirm

Önizleme

Repeat the password.

// components/new-password-fields.tsx
"use client";
 
import { useState } from "react";
 
import { useViraPassword } from "@virastack/password";
 
export function NewPasswordFields() {
  const [password, setPassword] = useState("");
 
  const { inputProps, btnProps } = useViraPassword({
    inputProps: { value: password, onChange: (event) => setPassword(event.target.value) },
  });
  // Same hook with matchWith. Each field keeps its own show/hide button.
  const {
    inputProps: confirmProps,
    btnProps: confirmButton,
    matches,
  } = useViraPassword({ matchWith: password });
 
  return (
    <>
      <label htmlFor={inputProps.id}>New password</label>
      <div>
        <input {...inputProps} />
        <button {...btnProps} />
      </div>
 
      <label htmlFor={confirmProps.id}>Confirm password</label>
      <div>
        <input {...confirmProps} />
        <button {...confirmButton} />
      </div>
 
      <p aria-live="polite">
        {matches === null && "Repeat the password."}
        {matches === true && "Passwords match."}
        {matches === false && "Passwords don't match."}
      </p>
    </>
  );
}

Detaylar

  • Tekrar alanı boşken matches null olur.
  • Her alanın kendi göster/gizle butonu vardır.
  • İki alan da varsayılan olarak autoComplete="new-password" alır.

Hook API için useViraPassword(), stil ve ikonlar için customization.

ÖncekiÖzel metinSonrakiProgramatik

Bu sayfada

  • Önizleme
  • Detaylar
Hata mı var? Düzeltin