Skip to content

DirectionalIcon

XS · 350B gzip budget

Mirrors a directional icon (arrows, chevrons) under RTL.

Category
Internationalisation
Budget
xs, static display primitive
External runtime
React / React DOM only
axe fixtureSSR rendersource scanbundle budget

Preview

Live fixture
Preview locale

Try the component here. Locale-aware formatting and direction follow the selected language; example content and labels are not automatically translated. Overlay demos use interactive launchers.

Install

npx shadcn@latest add https://gear5-ui.vercel.app/r/directional-icon.json

Copies the source into your project. Pulls in 1 shared registry item: cn.

New here? Set up Tailwind and import aliases first →

Source & props

Edit on GitHub ↗

Prop types and inline documentation are included below. This is repository source; the installer rewrites shared imports for your project.

import { cn } from "../lib/cn";

export interface DirectionalIconProps {
  children: React.ReactNode;
  className?: string;
}

/**
 * Wraps an icon that points somewhere — an arrow, a chevron, a "next" glyph —
 * and mirrors it under RTL via `rtl:-scale-x-100`. Icons that represent
 * physical direction (a play button, a checkmark) should not be wrapped in
 * this; only ones whose meaning is "forward/back" or "next/previous" relative
 * to reading direction.
 */
export function DirectionalIcon({ children, className }: DirectionalIconProps) {
  return (
    <span aria-hidden="true" className={cn("inline-flex rtl:-scale-x-100", className)}>
      {children}
    </span>
  );
}

What CI checks

Quality contract
  • Bundled, minified and gzipped against its tier budget
  • Audited by axe in the state previewed above
  • Rendered through react-dom/server with no browser globals
  • Scanned for network calls, dangerous sinks, and unguarded animation