DirectionalIcon
XS, under 350B gzippedMirrors a directional icon (arrows, chevrons) under RTL.
- Category
- Internationalisation
- Budget
- xs, static display primitive
- Runtime deps
- None
Preview
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.jsonCopies 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
- 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