Skip to content

DirectionalIcon

XS, under 350B gzipped

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

Category
Internationalisation
Budget
xs, static display primitive
Runtime deps
None

Preview

Preview language

This is the exact fixture the conformance suite renders in CI. Switch the language to see the component mirror and reformat.

Install

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

Copies the source into your project. Pulls in 1 primitive: cn.

Source

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

← All components