video-camera-slash

An animated video-camera-slash icon for React built on motion/react, rendering a camera with a diagonal slash that shakes horizontally on hover or when controlled via ref. It is a drop-in SVG component with a small imperative handle for start and stop control.

video-camera-slash
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 @heroicons-animated/video-camera-slash

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

Usage

usage.tsx
import { VideoCameraSlashIcon } from "@/components/ui/video-camera-slash";export function Example() {  return <VideoCameraSlashIcon size={28} className="text-zinc-700" />;}
  • Showing that camera or video is disabled, muted, or unavailable in a call, meeting, or media toolbar
  • Toggling a video-off state in settings or form controls where a hover cue reinforces the meaning
  • Adding subtle, attention-drawing micro-interactions to navigation or menu items
  • Driving the shake programmatically from a parent through a ref when a state change occurs

Examples

Hover-driven icon in a toolbar button

The icon animates automatically on mouse enter and resets on mouse leave, with no extra wiring.

hover-driven-icon-in-a-toolbar-button.tsx
import { VideoCameraSlashIcon } from "@/components/ui/video-camera-slash";export function CameraOffButton() {  return (    <button type="button" className="inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm">      <VideoCameraSlashIcon size={20} className="text-red-600" />      Camera off    </button>  );}

Programmatic control via ref

Use the imperative handle to start or stop the shake from parent logic, such as when a camera is toggled.

programmatic-control-via-ref.tsx
import { useRef } from "react";import { VideoCameraSlashIcon, type VideoCameraSlashIconHandle } from "@/components/ui/video-camera-slash";export function CameraStatus() {  const iconRef = useRef<VideoCameraSlashIconHandle>(null);  return (    <div      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <VideoCameraSlashIcon ref={iconRef} size={32} />    </div>  );}

Menu item with a larger icon

Pass a larger size and a utility class to fit a sidebar navigation entry.

menu-item-with-a-larger-icon.tsx
import { VideoCameraSlashIcon } from "@/components/ui/video-camera-slash";export function SidebarItem() {  return (    <a href="/settings/video" className="flex items-center gap-3 p-2 hover:bg-zinc-100">      <VideoCameraSlashIcon size={24} className="text-zinc-900" />      <span>Video settings</span>    </a>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes of the svg element.
classNamestring—Class name applied to the outer wrapper div, passed through cn(). Use it to set color (via currentColor), margins, or layout.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. When a ref handle is attached, this is called instead of the built-in animation start; otherwise it is invoked alongside the default animation trigger.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. When a ref handle is attached, this is called instead of the built-in animation reset; otherwise it is invoked alongside the default reset trigger.
refReact.Ref<VideoCameraSlashIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it switches the component to controlled mode, disabling automatic hover animation.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title, desc, or role attribute, so it is decorative by default; add aria-hidden="true" when a text label is present nearby.
  • When the icon is the only content of a control, give the parent button an accessible name via aria-label or visible text, since the icon itself carries no text alternative.
  • The shake is a brief horizontal motion of about 0.6s; it is not looping, but avoid relying on hover alone to convey state. Pair the icon with text or a state attribute such as aria-pressed.
  • Color comes from currentColor, so ensure the chosen foreground color meets WCAG contrast against its background.

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 "video-camera-slash" component (heroicons-animated/video-camera-slash) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/video-camera-slash2. 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 { VideoCameraSlashIcon } from "@/components/ui/video-camera-slash";export function Example() {  return <VideoCameraSlashIcon size={28} className="text-zinc-700" />;}```

Files & dependencies

  • video-camera-slash.tsx
dependenciesmotion

Looks similar, elsewhere