Bundle Size
Much smaller with tree-shaking (~950 bytes per flag vs. 200 KB+)
Quick guide for migrating from react-circle-flags to @sankyu/react-circle-flags.
Bundle Size
Much smaller with tree-shaking (~950 bytes per flag vs. 200 KB+)
TypeScript
Full type definitions with autocomplete for all 400+ flags
Modern
JSX automatic runtime, React 19 ready, zero dependencies
Quick migration with minimal changes — compatible component API:
import { CircleFlag } from 'react-circle-flags'
<CircleFlag countryCode="us" height="35" />import { CircleFlag } from '@sankyu/react-circle-flags'
<CircleFlag countryCode="us" height={35} />countryCode propcode prop for backward compatibilityBest performance — bundled SVGs, automatic tree-shaking:
import { CircleFlag } from 'react-circle-flags'
<CircleFlag countryCode="us" height="35" /><CircleFlag countryCode="cn" height="35" />import { FlagUs, FlagCn } from '@sankyu/react-circle-flags'
<FlagUs width={35} height={35} /><FlagCn width={35} height={35} />| Approach | Bundle Size | Network | Offline |
|---|---|---|---|
react-circle-flags | ~200 KB+ | None | ✅ |
CircleFlag (CDN) | ~2 KB | Per flag | ❌ |
| Named imports (3 flags) | ~2.8 KB | None | ✅ |
npm uninstall react-circle-flagsnpm install @sankyu/react-circle-flagspnpm remove react-circle-flagspnpm add @sankyu/react-circle-flagsyarn remove react-circle-flagsyarn add @sankyu/react-circle-flagsUpdate imports:
# Path 1: API-compatible import { CircleFlag } from 'react-circle-flags' import { CircleFlag } from '@sankyu/react-circle-flags'
# Path 2: Named imports (recommended) import { CircleFlag } from 'react-circle-flags' import { FlagUs, FlagCn } from '@sankyu/react-circle-flags'Update props:
<CircleFlag countryCode="us" height="35" // string height={35} // number/>If country codes are determined at runtime:
import { CircleFlag } from '@sankyu/react-circle-flags'
function UserFlag({ code }: { code: string }) { return <CircleFlag countryCode={code} height={32} />}Bundle: ~2 KB
import { DynamicFlag } from '@sankyu/react-circle-flags'
function UserFlag({ code }: { code: string }) { return <DynamicFlag code={code} width={32} height={32} />}Bundle: ~600 KB (all flags bundled)
| Feature | react-circle-flags | @sankyu/react-circle-flags |
|---|---|---|
| Default import style | <CircleFlag /> | Named exports or CircleFlag |
| Prop format | height="35" | height={35} |
| Tree-shaking | ❌ Limited | ✅ Excellent |
| TypeScript | ❌ No types | ✅ Full types |
| Bundle size (3 flags) | ~200 KB | ~2.8 KB |
| Dynamic loading | ❌ No | ✅ CircleFlag (CDN) |
| Offline support | ✅ Yes | ✅ Yes (named imports) |