IndexPackages

react-app-store-buttons

React components for app store and platform download buttons (App Store, Google Play, Chrome Extension, Windows, macOS, Linux)


πŸ’One Code to rule them all β€” and in the cloud compile them.
DocumentationOpen in StackBlitz
NPM Monthly Downloadsnpm versionNPM Total DownloadsTypeScript typesInstall size

πŸ€– Agent skill β€” npx skills@latest add https://github.com/OpenSourceAGI/dev-tools-starter-agent --skill app-store-buttons (what it covers)

React badge components for app store and platform download links. Badges ship as bundled assets β€” no CDN required. DEMO

screen

Install

npm install react-native-app-buttons

Import the bundled stylesheet if your project doesn't use Tailwind:

import "react-native-app-buttons/styles";

Features

  • 8 platforms β€” iOS App Store, Google Play, Chrome Web Store, Mac App Store, Microsoft Store, Linux, Snap Store
  • appId prop β€” pass your app identifier and the correct store URL is built automatically per platform
  • Native deep links β€” when the user is on the matching OS the button uses the native store protocol (itms-apps://, macappstore://, market://, ms-windows-store://) so the store app opens directly
  • autoHighlight β€” detects the user's OS via navigator.userAgent and applies a golden glow ring to the matching platform button
  • highlight β€” manually force the golden glow on any button
  • newTab β€” open in new tab (default) or same tab
  • height β€” badge image height in px (default 56)
  • Exported utilities β€” getOS(), OS enum, buildStoreUrl(), buildDeepLink(), platformMatchesOS()

Usage

import { DownloadAppButton } from "react-native-app-buttons";

<DownloadAppButton platform="ios"              appId="6474268307"               autoHighlight />
<DownloadAppButton platform="android"          appId="com.example.app"          autoHighlight />
<DownloadAppButton platform="chrome-extension" appId="noecbaibfh..."            autoHighlight />
<DownloadAppButton platform="macos"            appId="6474268307"               autoHighlight />
<DownloadAppButton platform="windows"          appId="9NBLGGH4NNS1"             autoHighlight />
<DownloadAppButton platform="linux-snap"       appId="my-app"                   autoHighlight />
<DownloadAppButton platform="linux"            href="https://example.com/linux" autoHighlight />

Pass href instead of appId to use an explicit URL:

<DownloadAppButton platform="ios" href="https://apps.apple.com/app/id6474268307" />

Props

PropTypeDefaultNotes
platformPlatformβ€”Required
appIdstringβ€”Either appId or href required
hrefstringβ€”Either appId or href required
autoHighlightbooleanfalseGolden glow when OS matches platform
highlightbooleanβ€”Force glow on/off; overrides autoHighlight
newTabbooleantruetarget="_blank"
heightnumber56Badge height in px
classNamestring""Extra classes on <a>
altstringPlatform labelAccessible alt text
PlatformNative deep linkWeb fallback
iOSitms-apps://itunes.apple.com/app/id{id}https://apps.apple.com/app/id{id}
macOSmacappstore://itunes.apple.com/app/id{id}https://apps.apple.com/app/id{id}
Androidmarket://details?id={pkg}https://play.google.com/store/apps/details?id={pkg}
Windowsms-windows-store://pdp/?productid={id}https://apps.microsoft.com/detail/{id}?rtc=1
Chromeβ€”https://chromewebstore.google.com/detail/{id}
Snapβ€”https://snapcraft.io/{name}

Utilities

import { getOS, OS, platformMatchesOS, buildStoreUrl, buildDeepLink, resolveHref } from "react-native-app-buttons";

getOS()                                             // β†’ OS.macOS | OS.Windows | OS.Linux | …
platformMatchesOS("macos", getOS())                 // β†’ true on macOS
buildStoreUrl("android", "com.example.app")         // β†’ "https://play.google.com/…"
buildDeepLink("android", "com.example.app")         // β†’ "market://details?id=…"
resolveHref("android", "com.example.app", getOS()) // β†’ deep link on Android, web elsewhere

Dev

npm run dev        # demo at http://localhost:5173
        build      # library build β†’ dist/
        typecheck

PRs Welcome

Please star this repo for updates! 🌟


Source: packages/react-app-store-buttons/README.md

Last updated on

On this page