shipOptimizing Perk Frames on Mobile

For mobile devices, you may want to use a small clickable icon instead of displaying the full Perk Frame by default.

circle-info

Why optimize it?

Don't let Perk Frames take away too much of your apps UI - they are supposed to blend in.


Mobile-Friendly: Toggle Icon Approach

How It Works

  1. On mobile: A small gift icon appears in the corner

  2. User taps the icon: The full Perk Frame pops up

  3. On desktop: The Perk Frame shows normally (or you can use the icon approach too)


Implementation

Step 1: Add the HTML

Add this code where you want the Perk Frame to appear:

<!-- Perk Frame Container (hidden by default on mobile) -->
<div class="solana-id-YOUR-AGENT-ID-HERE perk-frame-container"></div>

<!-- Mobile Toggle Icon (only visible on mobile) -->
<button class="perk-toggle-icon" aria-label="View your perks">
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="32" height="32">
    <path fill="currentColor" d="M190.5 68.8L225.3 128H224 152c-22.1 0-40-17.9-40-40s17.9-40 40-40h2.2c14.9 0 28.8 7.9 36.3 20.8zM64 88c0 14.4 3.5 28 9.6 40H32c-17.7 0-32 14.3-32 32v64c0 17.7 14.3 32 32 32H480c17.7 0 32-14.3 32-32V160c0-17.7-14.3-32-32-32H438.4c6.1-12 9.6-25.6 9.6-40c0-48.6-39.4-88-88-88h-2.2c-31.9 0-61.5 16.9-77.7 44.4L256 85.5l-24.1-41C215.7 16.9 186.1 0 154.2 0H152C103.4 0 64 39.4 64 88zm336 0c0 22.1-17.9 40-40 40H288h-1.3l34.8-59.2C329.1 55.9 342.9 48 357.8 48H360c22.1 0 40 17.9 40 40zM32 288V464c0 26.5 21.5 48 48 48H224V288H32zM288 512H432c26.5 0 48-21.5 48-48V288H288V512z"/>
  </svg>
  <span class="perk-notification-dot"></span>
</button>

<!-- Perk Frame Script -->
<script src="https://perk.solana.id/solanaid-perkframe.bundle.js"></script>

Step 2: Add the CSS


Step 3: Add the JavaScript

Add this script to handle the toggle functionality:


Alternative: Icon Shows on All Screen Sizes

If you want the toggle icon approach on both mobile and desktop (not just mobile), use this simplified CSS instead:


Customization Options

Change Icon Color

Change Icon Size

Use a Different Icon

Replace the SVG with your own:

  • Gift box (current)

  • Bell icon (for notifications)

  • Star icon (for rewards)

  • Custom logo

Last updated