Nauru Flag

NauruFlag is a typed React component that renders the flag of Nauru through the shared Flag base component, with the country code fixed to "nr". It is intended for country pickers, profiles, and any UI that needs a Nauru flag at a consistent 4:3, 1:1, or original aspect ratio.

componentflagscountriesinternationalizationregistry-item.json
Nauru Flag
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @flagcn/nr

Requires @flagcn in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { NauruFlag } from "@/components/flags/countries/nr"export function CountryBadge() {  return <NauruFlag />}
  • Show Nauru's flag next to a country name in a select, combobox, or country list.
  • Display a flag in user profiles, shipping or address forms, or location badges.
  • Render flags at a fixed square (1:1) or 4:3 frame so that a grid of country flags stays aligned.
  • Use it in internationalized UIs where flags must be imported by type rather than by hand-written image paths.

Examples

Default flag

Renders the Nauru flag with the default accessible label "Nauru flag".

default-flag.tsx
import { NauruFlag } from "@/components/flags/countries/nr"export function Default() {  return <NauruFlag />}

Country picker option

Uses a custom alt text when the flag sits beside a visible country name, so the label is not repeated for screen readers.

country-picker-option.tsx
import { NauruFlag } from "@/components/flags/countries/nr"export function CountryOption() {  return (    <div className="flex items-center gap-2">      <NauruFlag alt="" />      <span>Nauru</span>    </div>  )}

Profile location

Shows a labeled flag for a user's country in a profile header.

profile-location.tsx
import { NauruFlag } from "@/components/flags/countries/nr"export function ProfileLocation() {  return (    <p className="flex items-center gap-2">      <NauruFlag alt="Country: Nauru" />      Nauru    </p>  )}

API reference

PropTypeDefaultDescription
altstring"Nauru flag"Accessible text passed to the underlying Flag. Override it to match context, or pass an empty string when the country name is already visible nearby.
...propsOmit<FlagProps, "code">—All other FlagProps from the shared Flag component are forwarded, except code, which is fixed to "nr" and cannot be changed. The exact list of these props is defined in ../flag and is not included in this item's source.

Accessibility

  • The default alt is "Nauru flag", so the image has a meaningful name for screen readers when used on its own.
  • When the country name is visible beside the flag, pass alt="" to avoid announcing the name twice, and confirm that the Flag implementation treats an empty alt as decorative.
  • Provide more specific alt text in context, such as "Country: Nauru", when the flag conveys information that is not otherwise shown.
  • The component does not add color-only meaning; always pair the flag with a text label where the country choice matters.

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.

prompt.md
Use the "Nauru Flag" component (flagcn/nr) from its shadcn registry.1. Install it with: npx shadcn@latest add @flagcn/nr2. 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: alt, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { NauruFlag } from "@/components/flags/countries/nr"export function CountryBadge() {  return <NauruFlag />}```

Files & dependencies

  • src/components/flags/countries/nr.tsx→ @components/flags/countries/nr.tsx
registryDependencies@flagcn/flag

Looks similar, elsewhere