Togo Flag

TogoFlag is a typed React component that renders the national flag of Togo (code "tg") through the shared Flag primitive. It is installed as a registry:component and supports the no-crop 4:3 and 1:1 frames plus SVG, PNG, WebP, and JPEG assets.

componentflagscountriesinternationalizationregistry-item.json
Togo 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/tg

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

Usage

usage.tsx
import { TogoFlag } from "@/components/flags/countries/tg"export function Example() {  return <TogoFlag alt="Togo flag" />}
  • Show Togo's flag next to country names in selects, tables, address forms, or profile pages.
  • Display a flag in a multilingual or localized UI where users pick a country or region.
  • Use a typed, country-specific wrapper so the code "tg" cannot be set incorrectly by mistake.
  • Pair it with other @flagcn country components when rendering a list of flags with a consistent API.

Examples

Default flag

Renders the Togo flag with the default alt text "Togo flag".

default-flag.tsx
import { TogoFlag } from "@/components/flags/countries/tg"export function DefaultTogoFlag() {  return <TogoFlag />}

Custom alt text in a country row

Overrides alt for a localized label next to the country name.

custom-alt-text-in-a-country-row.tsx
import { TogoFlag } from "@/components/flags/countries/tg"export function CountryRow() {  return (    <div className="flex items-center gap-2">      <TogoFlag alt="Flag of Togo" />      <span>Togo</span>    </div>  )}

Country picker option list

Maps a list of options where Togo's flag is rendered alongside other flag components.

country-picker-option-list.tsx
import { TogoFlag } from "@/components/flags/countries/tg"const options = [{ label: "Togo", Flag: TogoFlag }]export function CountryOptions() {  return (    <ul>      {options.map(({ label, Flag }) => (        <li key={label} className="flex items-center gap-2">          <Flag alt={`${label} flag`} />          {label}        </li>      ))}    </ul>  )}

API reference

PropTypeDefaultDescription
altstring"Togo flag"Accessible text for the flag image. Defaults to "Togo flag". Pass a localized or more specific string when the flag is shown in context.
...FlagProps (except code)Omit<FlagProps, "code">—All remaining props of the shared Flag component are forwarded via rest spread to Flag. The code prop is omitted from the type and is fixed to "tg" internally. The full list is defined in the flag registry item (../flag) and is not reproduced in this source file.

Accessibility

  • The default alt text "Togo flag" gives screen readers a meaningful name; override it with a localized string for non-English interfaces.
  • If the flag appears directly beside the visible text "Togo", consider setting alt to an empty string to avoid redundant announcements, since the name is already read out.
  • Do not pass the code prop; TogoFlag omits it from its type and always renders code "tg".
  • Ensure the flag has sufficient size in the layout so that the star and stripes remain distinguishable.

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 "Togo Flag" component (flagcn/tg) from its shadcn registry.1. Install it with: npx shadcn@latest add @flagcn/tg2. 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, ...FlagProps (except code).Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { TogoFlag } from "@/components/flags/countries/tg"export function Example() {  return <TogoFlag alt="Togo flag" />}```

Files & dependencies

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

Looks similar, elsewhere