eye-off

An animated eye-off (hidden eye) icon from the hugeicons-animated registry. On hover it draws a diagonal slash across the eye, which then sweeps away and returns, and the eye outline and pupil redraw along the way.

eye-off
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @hugeicons-animated/eye-off

Requires @hugeicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { EyeOffIcon } from '@/components/ui/eye-off';export function Example() {  return <EyeOffIcon size={28} className="text-zinc-700" />;}
  • Show or hide password and secret field toggles, where the eye-off state means content is currently hidden.
  • Visibility toggles in dashboards, settings, and privacy controls that need a hover-triggered micro-interaction.
  • Ref-driven feedback, such as playing the animation when a hide action succeeds, by calling startAnimation on the handle.
  • Decorative or branded UI where an animated icon adds personality without a looping distraction.

Examples

Password visibility toggle

Hover-triggered icon inside a button that toggles password visibility. The icon's own onMouseEnter is wired through the props.

password-visibility-toggle.tsx
'use client';import { useState } from 'react';import { EyeOffIcon } from '@/components/ui/eye-off';export function PasswordToggle() {  const [visible, setVisible] = useState(false);  return (    <button      type="button"      aria-label={visible ? 'Hide password' : 'Show password'}      aria-pressed={visible}      onClick={() => setVisible((v) => !v)}      className="inline-flex size-9 items-center justify-center rounded-md text-zinc-600 hover:bg-zinc-100"    >      <EyeOffIcon size={20} />    </button>  );}

Programmatic playback via ref

Uses the forwarded ref to call startAnimation, for example after a hide action completes. Note that startAnimation is a no-op when the user prefers reduced motion.

programmatic-playback-via-ref.tsx
'use client';import { useRef } from 'react';import { EyeOffIcon, type EyeOffIconHandle } from '@/components/ui/eye-off';export function HideConfirm() {  const iconRef = useRef<EyeOffIconHandle>(null);  return (    <div onClick={() => iconRef.current?.startAnimation()} className="inline-flex cursor-pointer items-center gap-2">      <EyeOffIcon ref={iconRef} size={24} />      <span>Hidden from public view</span>    </div>  );}

Sizing and color via className

The size prop sets the SVG width and height in pixels. The className is applied to the wrapping div, and the stroke follows currentColor.

sizing-and-color-via-classname.tsx
import { EyeOffIcon } from '@/components/ui/eye-off';export function PrivacyBadge() {  return (    <span className="inline-flex items-center gap-1 rounded-full bg-amber-50 px-2 py-1 text-amber-700">      <EyeOffIcon size={16} className="text-amber-600" />      Private    </span>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the rendered SVG in pixels. The viewBox stays 0 0 24 24.
classNamestring—Class name applied to the outer div wrapper, passed through cn(). Use it for color, margin, and layout.
onMouseEnterMouseEventHandler<HTMLDivElement>—Called before the hover animation starts. Inherited from HTMLAttributes<HTMLDivElement>; when a ref is attached, the built-in hover trigger is disabled and this handler still fires.
onMouseLeaveMouseEventHandler<HTMLDivElement>—Called on mouse leave. Inherited from HTMLAttributes<HTMLDivElement>. Because loops is false, leaving does not reset the animation.
refRef<EyeOffIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Using the ref switches the icon to controlled mode, so hover no longer starts the animation automatically. stopAnimation is a no-op here because loops is false.
...propsHTMLAttributes<HTMLDivElement>—Any other div attributes (id, style, aria-*, data-*, and so on) are spread onto the outer wrapper div, not the svg.

Accessibility

  • The SVG has no role, title, or aria-label, so it is treated as decorative. When the icon is the only content of a control, put aria-label or a visually hidden label on the parent button, as the password toggle example does.
  • Animation is skipped when the user has prefers-reduced-motion enabled, because the hook checks useReducedMotion before calling startAnimation.
  • The animation is one-shot and does not loop, so it does not create persistent motion for users who are sensitive to it.
  • Use aria-pressed or an explicit label on toggle buttons so screen readers announce the state change, not just the icon's appearance.
  • Ensure the icon color has sufficient contrast against its background, since strokes use currentColor.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "eye-off" component (hugeicons-animated/eye-off) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/eye-off2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, className, onMouseEnter, onMouseLeave, ref, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { EyeOffIcon } from '@/components/ui/eye-off';export function Example() {  return <EyeOffIcon size={28} className="text-zinc-700" />;}```

Files & dependencies

  • icons/eye-off.tsx
  • lib/use-icon-animation.ts
dependenciesmotion

Looks similar, elsewhere