Skip to content

madiyar/smartbanner-tsx

Repository files navigation

smartbanner-tsx

Smart App Banner for React v18+ (TypeScript) β€” a customizable React component for promoting iOS and Android apps on mobile websites. Lightweight, flexible, and easy to integrate with your own styles or use the default native-like appearance.

🎯 Live Demo: madiyar.github.io/smartbanner-tsx
πŸ™ Based on: react-smartbanner

npm version npm size

πŸš€ Features

  • πŸ“± Device detection using ua-parser-js to target iOS and Android only
  • 🧠 Built-in cookie logic (via js-cookie) to hide banner for a period after user action
  • 🧩 Customizable behavior β€” pass custom app links, metadata, and localization strings
  • 🎨 Styling flexibility β€” use default styles or override with your own CSS
  • πŸŒ€ React Portal support β€” render banner outside normal DOM flow
  • βœ… Written in TypeScript β€” includes full typings for a smooth developer experience
  • πŸ§ͺ Works with React v18+

πŸ“¦ Installation

npm install smartbanner-tsx
# or
yarn add smartbanner-tsx
# or
pnpm add smartbanner-tsx

βš™οΈ Usage

  1. Add meta tags to <head>
<!-- Example using YouTube app -->
<head>
  <meta name="apple-itunes-app" content="app-id=544007664" />
  <meta name="google-play-app" content="app-id=com.google.android.youtube" />
  <link rel="apple-touch-icon" href="icon.webp" />
  <link rel="android-touch-icon" href="icon.webp" />
</head>
  1. Import and use the component
import { SmartBanner } from "smartbanner-tsx";
import "smartbanner-tsx/dist/style.css"; // or use your own CSS file

// ...

export default function App() {
  return <SmartBanner title="YouTube" author="Google" />;
}

🧩 Props

See full list with descriptions and defaults on the Demo Page.

πŸ“œ License

MIT β€” madiyar

πŸ” Keywords (for SEO)

react smart app banner, smartbanner react, custom smart banner react, react app store banner, ios smart banner, react component app banner, app promotion banner

About

πŸ“± Smart App Banner for React

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors