input

Input label with link and visibility toggle

Input label with link and visibility toggle

Загрузка превью…

src/input/c-input-19.vue

<!--
  Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
  (lucide-react v0.545.0 "eye") — см. docs/PORTING.md §5. Тумблер
  видимости пароля зафиксирован в начальном состоянии оригинала
  (`isVisible === false`) — значения полей задаются фиксированными
  пропсами, чтобы статика совпадала без взаимодействия.
-->
<script setup lang="ts">
import { Field, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
</script>

<template>
  <Field class="w-full max-w-xs">
    <div class="flex items-center justify-between">
      <FieldLabel for="password-link">Password</FieldLabel>
      <a href="#" class="text-primary text-xs font-medium hover:underline">Forgot password?</a>
    </div>
    <div class="relative">
      <Input id="password-link" type="password" class="pe-9" />
      <button
        aria-label="Show password"
        aria-pressed="false"
        class="text-muted-foreground/80 hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50"
        type="button"
      >
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="24"
          height="24"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
          stroke-linecap="round"
          stroke-linejoin="round"
          class="lucide lucide-eye"
          aria-hidden="true"
        >
          <path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />
          <circle cx="12" cy="12" r="3" />
        </svg>
      </button>
    </div>
  </Field>
</template>

Установка

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-input-19.json

Зависимости реестра

Источник: порт из ReUI (Keenthemes, MIT)