Ghana Flag

GhanaFlag is a typed React component that renders the Ghana national flag by delegating to the shared Flag primitive with code fixed to "gh". It is provided in the flagcn registry and ships with the @flagcn/flag dependency.

componentflagscountriesinternationalizationregistry-item.json
Ghana 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/gh

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

Usage

usage.tsx
import { GhanaFlag } from "@/components/flags/countries/gh"export function Example() {  return <GhanaFlag />}
  • Showing Ghana's national flag next to a country name in a country picker, select list, or directory.
  • Displaying Ghana in a list of flags for a sports, event, or travel page where a consistent flag frame is needed.
  • Rendering a typed, ready-made Ghana flag so that callers do not need to pass the country code manually.
  • Using a fixed-aspect 4:3 or 1:1 presentation without cropping the artwork.

Examples

Default flag

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

default-flag.tsx
import { GhanaFlag } from "@/components/flags/countries/gh"export function DefaultGhanaFlag() {  return <GhanaFlag />}

Country picker option

Places the flag beside a visible country name. A custom alt is supplied so the label is not repeated for screen readers in a way that conflicts with the visible text.

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

Custom alt text for a descriptive context

Overrides the default alt text when the flag conveys specific meaning, such as a team or delegation representing Ghana.

custom-alt-text-for-a-descriptive-context.tsx
import { GhanaFlag } from "@/components/flags/countries/gh"export function DelegationFlag() {  return <GhanaFlag alt="Flag of the Ghana delegation" />}

API reference

PropTypeDefaultDescription
altstring"Ghana flag"Accessible text for the flag image. Defaults to "Ghana flag" and can be overridden when the context calls for different wording.
...propsOmit<FlagProps, "code">—All remaining FlagProps from @flagcn/flag are forwarded to Flag. The code prop is fixed to "gh" and cannot be overridden. The full FlagProps shape is defined in the flag registry item and is not reproduced here.

Accessibility

  • The default alt text is "Ghana flag", so the image is announced without extra configuration.
  • When the country name is already visible next to the flag, pass alt="" to avoid duplicate announcements, and confirm that the underlying Flag handles an empty alt as decorative.
  • Override alt with a more specific phrase when the flag identifies a particular team, delegation, or context.
  • Because the component only forwards props to Flag, any accessibility behaviour for sizing or focus comes from the shared Flag implementation; review @flagcn/flag before relying on it for interactive use.

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 "Ghana Flag" component (flagcn/gh) from its shadcn registry.1. Install it with: npx shadcn@latest add @flagcn/gh2. 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 { GhanaFlag } from "@/components/flags/countries/gh"export function Example() {  return <GhanaFlag />}```

Files & dependencies

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

Looks similar, elsewhere