mail-01

mail-01 is an animated mail (envelope) icon from the hugeicons-animated registry. Hovering the icon plays a short one-shot sequence in which the envelope flap opens, overshoots, and closes while the body squashes slightly and the rear edge reveals a mask.

mail-01
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/mail-01

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

Usage

usage.tsx
import { Mail01Icon } from '@/icons/mail-01';export function MailButton() {  return <Mail01Icon size={24} className='text-foreground' />;}
  • Adding an animated mail, inbox, or message indicator to a navigation bar, sidebar, or header
  • Showing a new-message or notification affordance on a button or menu item that reacts on hover
  • Building a contact or newsletter CTA where a subtle hover motion draws attention without a heavy effect
  • Driving the icon imperatively via a ref, for example to play the envelope animation when a new message arrives

Examples

Hover-to-animate icon in a button

Default usage. The animation plays on mouse enter, and color is controlled through className using currentColor.

hover-to-animate-icon-in-a-button.tsx
import { Mail01Icon } from '@/icons/mail-01';export function InboxButton() {  return (    <button type='button' className='inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm hover:bg-muted'>      <Mail01Icon size={20} className='text-muted-foreground' />      Inbox    </button>  );}

Imperative trigger via ref

Passing a ref switches the icon into controlled mode, so hovering no longer auto-plays and the animation runs only when startAnimation is called.

imperative-trigger-via-ref.tsx
import { useRef } from 'react';import { Mail01Icon, type Mail01IconHandle } from '@/icons/mail-01';export function NewMessageAlert({ hasNewMessage }: { hasNewMessage: boolean }) {  const iconRef = useRef<Mail01IconHandle>(null);  return (    <div onClick={() => iconRef.current?.startAnimation()}>      <Mail01Icon ref={iconRef} size={28} className='text-primary' />      {hasNewMessage ? <span className='sr-only'>New message</span> : null}    </div>  );}

Navigation link with accessible label

Wraps the icon in a labelled link. The label is passed through the spread props to the wrapper div, and the link text provides the accessible name.

navigation-link-with-accessible-label.tsx
import { Mail01Icon } from '@/icons/mail-01';export function ContactNavLink() {  return (    <a href='/contact' className='flex items-center gap-2 text-sm font-medium'>      <Mail01Icon size={22} className='text-zinc-700 dark:text-zinc-200' aria-hidden='true' />      <span>Contact</span>    </a>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. The viewBox stays 0 0 24 24, so the icon scales proportionally.
classNamestring—Class names applied to the wrapping div. Use it to set color (via currentColor), margin, or layout.
onMouseEnterMouseEventHandler<HTMLDivElement>—Called on mouse enter before the built-in animation starts. Inherited from HTMLAttributes<HTMLDivElement>.
onMouseLeaveMouseEventHandler<HTMLDivElement>—Called on mouse leave. Inherited from HTMLAttributes<HTMLDivElement>. The built-in stop only has effect when loops is enabled internally, which it is not for this icon.
refRef<Mail01IconHandle>—Exposes startAnimation() and stopAnimation(). When a ref is attached, hover no longer triggers the animation automatically. stopAnimation() is a no-op for this icon because loops is fixed to false.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, aria-*, role, data-*, style, etc.) are spread onto the wrapping div.

Accessibility

  • The SVG has no title, role, or aria-label, so it is treated as decorative by default. Add aria-hidden='true' when a visible text label exists, or provide aria-label on the icon when it stands alone.
  • Attributes such as aria-label or role are forwarded to the wrapping div through the spread props, so the consumer controls the accessible name.
  • When the user has enabled reduced motion (prefers-reduced-motion), useReducedMotion causes startAnimation to return early, so the icon stays static.
  • Do not rely on the hover animation alone to convey new messages. Pair it with text, a badge, or a screen-reader-only status message.
  • Keep the icon color contrast at or above WCAG AA against its background, since it is drawn with 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 "mail-01" component (hugeicons-animated/mail-01) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/mail-012. 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 { Mail01Icon } from '@/icons/mail-01';export function MailButton() {  return <Mail01Icon size={24} className='text-foreground' />;}```

Files & dependencies

  • icons/mail-01.tsx
  • lib/use-icon-animation.ts
dependenciesmotion

Looks similar, elsewhere