Saudi Riyal
SaudiRiyalIcon is an animated Saudi Riyal (SAR) currency icon built with Motion. On hover it draws the riyal glyph's strokes in sequence, and it can also be controlled programmatically through a ref.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { SaudiRiyalIcon } from "@/components/ui/saudi-riyal";<SaudiRiyalIcon className="text-emerald-600" size={32} />- Showing a Saudi Riyal (SAR) currency indicator in pricing, checkout, wallet, or finance UIs where a playful micro-interaction helps.
- Adding a hover-triggered draw animation to a currency label or stat card in a Lucide-style icon set.
- Driving the animation from parent code (for example, when a payment step starts) through the imperative startAnimation and stopAnimation handle.
- Using a lightweight decorative icon whose size and color can be set with the size prop and Tailwind text color classes.
Examples
Hover animation (uncontrolled)
By default the icon animates on mouse enter and returns to the resting state on mouse leave. No ref is needed.
import { SaudiRiyalIcon } from "@/components/ui/saudi-riyal";export function CurrencyBadge() { return ( <div className="inline-flex items-center gap-2 text-sm font-medium"> <SaudiRiyalIcon size={18} className="text-emerald-600" /> <span>SAR 1,250.00</span> </div> );}Programmatic control via ref
Attach a ref typed as SaudiRiyalIconHandle to start or stop the animation from a parent event. Once a ref is attached, the icon stops animating on its own hover and defers to the parent's onMouseEnter and onMouseLeave props, which are unset here.
import { useRef } from "react";import { SaudiRiyalIcon, type SaudiRiyalIconHandle } from "@/components/ui/saudi-riyal";export function PayButton() { const ref = useRef<SaudiRiyalIconHandle>(null); return ( <button type="button" className="inline-flex items-center gap-2 rounded-md border px-4 py-2" onMouseEnter={() => ref.current?.startAnimation()} onMouseLeave={() => ref.current?.stopAnimation()} > <SaudiRiyalIcon ref={ref} size={20} /> Pay in SAR </button> );}Decorative icon next to a heading
Mark the icon as decorative with aria-hidden, since the adjacent text already conveys the meaning.
import { SaudiRiyalIcon } from "@/components/ui/saudi-riyal";export function WalletHeading() { return ( <h2 className="flex items-center gap-2 text-xl font-semibold"> <SaudiRiyalIcon aria-hidden="true" size={24} className="text-amber-500" /> Wallet balance </h2> );}API reference
Accessibility
- The icon is purely visual and the svg has no title, role, or aria-label. If the icon conveys meaning alone, add role="img" and an aria-label on the wrapper, or pair it with visible text.
- When the icon is decorative, as in a labelled currency amount, pass aria-hidden="true" so screen readers skip it.
- The outer div is not focusable and has no keyboard handler. For an interactive control, wrap the icon in a button or link and drive the animation with ref methods from focus and blur handlers as well as mouse events.
- The hover animation is not conditioned on prefers-reduced-motion. Consider disabling startAnimation calls or the built-in hover when the user prefers reduced motion.
- The icon uses currentColor, so it keeps the contrast of the surrounding text color. Verify contrast of the chosen text color against the 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.
Use the "Saudi Riyal" component (lucide-animated/saudi-riyal) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/saudi-riyal.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, ...props (HTMLAttributes<HTMLDivElement>), ref.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { SaudiRiyalIcon } from "@/components/ui/saudi-riyal";<SaudiRiyalIcon className="text-emerald-600" size={32} />```Files & dependencies
- saudi-riyal.tsx