npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@csauvage/app-store-button

v1.1.0

Published

A lightweight React component for rendering App Store, Mac App Store, Apple TV, and TestFlight download badges with full locale, theme, and QR code support.

Downloads

184

Readme

@csauvage/app-store-button

A lightweight React component for rendering App Store, Mac App Store, Apple TV, and TestFlight download badges — with full locale, theme, and QR code support.

On non-Apple devices, the badge automatically switches to a scannable QR code linking to your app.

Features

  • 4 store types — App Store, Mac App Store, Apple TV, TestFlight
  • 44 locales — from English to Arabic, Japanese, Chinese, and more
  • Dark & light themes — matches Apple's official badge styles
  • Pure inline SVG — no external CDN, no network requests, works offline
  • Device-aware QR codes — shows a QR code on desktop/Android, clickable badge on iPhone/iPad
  • TestFlight badges — programmatic SVG generation with full RTL and CJK support
  • Zero CSS — inline styles only, no stylesheet to import
  • Tree-shakeable — ESM + CJS, ships with TypeScript declarations
  • SSR safe — renders the badge by default, hydrates device detection client-side

Install

# npm
npm install @csauvage/app-store-button

# yarn
yarn add @csauvage/app-store-button

# pnpm
pnpm add @csauvage/app-store-button

# bun
bun add @csauvage/app-store-button

Peer dependencies: react >= 18 and react-dom >= 18

Quick Start

import { AppStoreButton, Store, Theme, Locale } from '@csauvage/app-store-button'

function App() {
  return (
    <AppStoreButton
      store={Store.AppStore}
      theme={Theme.Black}
      locale={Locale.EnUs}
      url="https://apps.apple.com/app/id123456789"
      showQrCode
    />
  )
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | store | Store | required | Which store badge to render | | action | Action | Action.Download | Download or pre-order. Ignored for TestFlight | | theme | Theme | Theme.Black | Badge color theme | | locale | Locale | Locale.EnUs | Badge language | | url | string | — | Link URL. Badge becomes clickable when set | | showQrCode | boolean | false | Show QR code on non-Apple devices instead of badge | | height | number | 40 | Badge height in px (width scales proportionally) | | qrSize | number | 120 | QR code size in px (square) | | className | string | — | CSS class on the wrapper element |

Enums

Store

| Value | Description | |-------|-------------| | Store.AppStore | iOS App Store | | Store.MacAppStore | Mac App Store | | Store.AppleTV | Apple TV App Store | | Store.TestFlight | TestFlight beta |

Action

| Value | Description | |-------|-------------| | Action.Download | "Download on the..." | | Action.PreOrder | "Pre-order on the..." |

Theme

| Value | Description | |-------|-------------| | Theme.Black | Dark background, light text | | Theme.White | Light background, dark text |

Locale

44 locales supported:

| Locale | Code | Locale | Code | |--------|------|--------|------| | Locale.EnUs | en-us | Locale.FrFr | fr-fr | | Locale.DeDe | de-de | Locale.EsEs | es-es | | Locale.ItIt | it-it | Locale.PtBr | pt-br | | Locale.Ja | ja | Locale.Ko | ko | | Locale.ZhCn | zh-cn | Locale.ZhTw | zh-tw | | Locale.ArSa | ar-sa | Locale.He | he | | Locale.Ru | ru | Locale.Tr | tr | | Locale.NlNl | nl-nl | Locale.Sv | sv | | Locale.Da | da | Locale.No | no | | Locale.Fi | fi | Locale.Pl | pl |

Az, Id, Ms, Ca, Cs, Da, DeDe, Et, EnUs, EsEs, EsMx, FrFr, FrCa, Hr, ItIt, Lv, Lt, Hu, Mt, NlNl, No, Pl, PtPt, PtBr, Ro, Sk, Sl, Fi, Sv, Tl, Vi, Tr, El, Bg, Ru, Uk, Hi, He, ArSa, Th, Ko, Ja, ZhCn, ZhTw

How It Works

Badge Rendering

All badges are rendered as pure inline SVG — no external CDN requests, no <img> tags, no network dependency. Badges work offline and render instantly.

For App Store, Mac App Store, and Apple TV, the SVG is assembled from pre-extracted vector path data (taken from Apple's official badge SVGs). This includes:

  • Apple logo as vector paths (not an image)
  • Locale-specific text as vector paths (no font dependency)
  • RTL support for Arabic and Hebrew (Apple logo shifts to the right)
  • Proper viewBox dimensions per locale

For TestFlight, a localized SVG is generated programmatically since Apple doesn't provide official TestFlight badges. The SVG includes:

  • Rounded-rect border matching Apple's badge style
  • Embedded TestFlight logo (base64 PNG)
  • Localized "Download on" text + "TestFlight" brand name
  • RTL support for Arabic and Hebrew (logo flips to right)
  • Inverted layout for CJK, Thai, and Hindi (brand name on top)

Device Detection & QR Codes

When showQrCode is enabled:

| Device | Behavior | |--------|----------| | iPhone / iPad | Shows the clickable badge (user can tap to download) | | Desktop / Android | Shows a QR code linking to the URL (user can scan) | | SSR | Renders the badge (safe default, hydrates client-side) |

QR codes are generated using the qrcode library and rendered as inline SVG. The QR code is also wrapped in a clickable link.

Examples

Basic App Store badge

<AppStoreButton store={Store.AppStore} />

French Mac App Store badge with link

<AppStoreButton
  store={Store.MacAppStore}
  locale={Locale.FrFr}
  url="https://apps.apple.com/fr/app/mon-app/id123456789"
/>

Pre-order badge

<AppStoreButton
  store={Store.AppStore}
  action={Action.PreOrder}
  locale={Locale.DeDe}
  url="https://apps.apple.com/de/app/meine-app/id123456789"
/>

TestFlight with light theme

<AppStoreButton
  store={Store.TestFlight}
  theme={Theme.White}
  locale={Locale.Ja}
  url="https://testflight.apple.com/join/abc123"
/>

QR code on desktop, badge on mobile

<AppStoreButton
  store={Store.AppStore}
  url="https://apps.apple.com/app/id123456789"
  showQrCode
  qrSize={150}
/>

Custom height

<AppStoreButton
  store={Store.AppStore}
  height={60}
  url="https://apps.apple.com/app/id123456789"
/>

See the /example folder for a complete working example using Onyria.

License

MIT - Clement Sauvage