Italic

ItalicIcon is an animated Lucide-style italic (slanted "I") SVG icon built with Motion. On hover the three strokes draw themselves in, or it can be driven imperatively via a ref with startAnimation and stopAnimation.

Italic
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 https://lucide-animated.com/r/italic.json

Usage

usage.tsx
import { ItalicIcon } from "@/components/ui/italic";export function Example() {  return <ItalicIcon />;}
  • Adding a text-formatting toolbar button for italic in a rich text editor or markdown editor
  • Decorating a navigation item, feature card, or CTA with a subtle hover animation tied to typography or styling
  • Showing an animated typography or font-style indicator in a settings or preferences panel
  • Triggering the draw-in animation programmatically (for example while content is loading) through a ref

Examples

Hover-driven icon in a toolbar button

Uses the default hover behavior inside a button. The wrapper div receives the mouse events and the animation runs on hover.

hover-driven-icon-in-a-toolbar-button.tsx
import { ItalicIcon } from "@/components/ui/italic";export function ItalicToolbarButton() {  return (    <button      type="button"      aria-label="Toggle italic"      className="inline-flex size-9 items-center justify-center rounded-md hover:bg-accent"    >      <ItalicIcon size={20} />    </button>  );}

Controlled animation via ref

Calls startAnimation and stopAnimation through a ref, for example to animate while a task is in progress. Once a ref is attached, hover no longer triggers the animation.

controlled-animation-via-ref.tsx
"use client";import { useRef, useEffect } from "react";import { ItalicIcon, type ItalicIconHandle } from "@/components/ui/italic";export function SavingIndicator({ saving }: { saving: boolean }) {  const iconRef = useRef<ItalicIconHandle>(null);  useEffect(() => {    if (saving) {      iconRef.current?.startAnimation();    } else {      iconRef.current?.stopAnimation();    }  }, [saving]);  return <ItalicIcon ref={iconRef} size={24} className="text-muted-foreground" />;}

Styled feature card heading

Places the icon next to a heading and passes a Tailwind class to color it. Extra HTML attributes such as aria-hidden are forwarded to the wrapper div.

styled-feature-card-heading.tsx
import { ItalicIcon } from "@/components/ui/italic";export function TypographyFeature() {  return (    <div className="flex items-center gap-3">      <ItalicIcon size={32} className="text-primary" aria-hidden="true" />      <h3 className="text-lg font-semibold">Italic styling</h3>    </div>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels, applied to both the width and height attributes.
classNamestring—Class name applied to the outer wrapper div. Passed through cn().
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler on the wrapper div. It is called in addition to the built-in hover animation when no ref is attached. When a ref is attached, it replaces the built-in animation and is called instead of it.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler on the wrapper div. Same behavior as onMouseEnter: when a ref is attached, it replaces the built-in reset animation.
refReact.Ref<ItalicIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it switches the icon to controlled mode, disabling automatic hover animation.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, data-*, and so on) are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title, desc, or role attribute. If the icon conveys meaning on its own, add aria-label to the wrapper or a visually hidden label. If it is decorative beside text, pass aria-hidden="true".
  • The icon is purely visual. Animation alone does not convey state, so pair any state change with a text label or aria-pressed on the parent button.
  • Hover-only animation is not available on touch devices or to keyboard users. Do not rely on it to reveal information.
  • Respect reduced motion preferences by wrapping calls to startAnimation in a check for prefers-reduced-motion, since the source does not do this automatically.
  • When the icon sits inside an interactive element, make sure that element is focusable and has an accessible name, because the wrapper div itself is not focusable.

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 "Italic" component (lucide-animated/italic) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/italic.json2. 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 { ItalicIcon } from "@/components/ui/italic";export function Example() {  return <ItalicIcon />;}```

Files & dependencies

  • italic.tsx
dependenciesmotion

Looks similar, elsewhere