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

@xsolla/xui-image-thumbnail

v0.106.0

Published

A cross-platform React component for displaying image thumbnails with overlays, tags at all four corners, and center content (like play buttons). Perfect for video thumbnails, screenshot galleries, and media previews.

Readme

ImageThumbnail

A cross-platform React component for displaying image thumbnails with overlays, tags at all four corners, and center content (like play buttons). Perfect for video thumbnails, screenshot galleries, and media previews.

Installation

npm install @xsolla/xui-image-thumbnail
# or
yarn add @xsolla/xui-image-thumbnail

Demo

Basic ImageThumbnail

import * as React from 'react';
import { ImageThumbnail } from '@xsolla/xui-image-thumbnail';

export default function BasicThumbnail() {
  return (
    <ImageThumbnail
      src="https://example.com/screenshot.jpg"
      alt="Game screenshot"
      ratio="16:9"
      width={320}
    />
  );
}

Video Thumbnail with Play Button

import * as React from 'react';
import { ImageThumbnail } from '@xsolla/xui-image-thumbnail';

const PlayButton = () => (
  <div style={{
    width: 48,
    height: 48,
    borderRadius: 24,
    backgroundColor: 'rgba(0, 0, 0, 0.5)',
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
  }}>
    <svg width="24" height="24" viewBox="0 0 24 24" fill="white">
      <path d="M8 5v14l11-7z" />
    </svg>
  </div>
);

export default function VideoThumbnail() {
  return (
    <ImageThumbnail
      src="https://example.com/video-preview.jpg"
      alt="Video preview"
      ratio="16:9"
      width={320}
      overlay="fade"
      centerContent={<PlayButton />}
    />
  );
}

Thumbnail with Tags

import * as React from 'react';
import { ImageThumbnail } from '@xsolla/xui-image-thumbnail';
import { Tag } from '@xsolla/xui-tag';
import { XsollaTicket } from '@xsolla/xui-icons-currency';

export default function ThumbnailWithTags() {
  return (
    <ImageThumbnail
      src="https://example.com/screenshot.jpg"
      alt="Screenshot with reward"
      ratio="16:9"
      width={320}
      overlay="fade"
      tagsBottomLeft={
        <Tag size="sm" tone="secondary" icon={<XsollaTicket />}>
          5x
        </Tag>
      }
    />
  );
}

All Corner Tags

import * as React from 'react';
import { ImageThumbnail } from '@xsolla/xui-image-thumbnail';
import { Tag } from '@xsolla/xui-tag';
import { Badge } from '@xsolla/xui-badge';

export default function AllCornerTags() {
  return (
    <ImageThumbnail
      src="https://example.com/screenshot.jpg"
      alt="Screenshot with all tags"
      ratio="16:9"
      width={400}
      overlay="fade"
      tagsTopLeft={<Tag size="sm" tone="brand">NEW</Tag>}
      tagsTopRight={<Tag size="sm" tone="secondary">2:30</Tag>}
      tagsBottomLeft={<Tag size="sm" tone="secondary">5x Tickets</Tag>}
      tagsBottomRight={<Badge size="lg" tone="success">HD</Badge>}
    />
  );
}

Overlay Types

import * as React from 'react';
import { ImageThumbnail } from '@xsolla/xui-image-thumbnail';

export default function OverlayTypes() {
  return (
    <div style={{ display: 'flex', gap: 16 }}>
      <div>
        <p>No Overlay</p>
        <ImageThumbnail
          src="https://example.com/image.jpg"
          ratio="16:9"
          width={200}
          overlay="none"
        />
      </div>
      <div>
        <p>Fade Overlay</p>
        <ImageThumbnail
          src="https://example.com/image.jpg"
          ratio="16:9"
          width={200}
          overlay="fade"
        />
      </div>
      <div>
        <p>Dark Overlay</p>
        <ImageThumbnail
          src="https://example.com/image.jpg"
          ratio="16:9"
          width={200}
          overlay="dark"
        />
      </div>
    </div>
  );
}

Aspect Ratios

import * as React from 'react';
import { ImageThumbnail } from '@xsolla/xui-image-thumbnail';

export default function AspectRatios() {
  const ratios = ['1:1', '16:9', '4:3', '3:2', '9:16'] as const;

  return (
    <div style={{ display: 'flex', gap: 16, flexWrap: 'wrap' }}>
      {ratios.map((ratio) => (
        <div key={ratio}>
          <p>{ratio}</p>
          <ImageThumbnail
            src="https://example.com/image.jpg"
            ratio={ratio}
            width={150}
            overlay="fade"
          />
        </div>
      ))}
    </div>
  );
}

Anatomy

Import the component and use it directly:

import { ImageThumbnail } from '@xsolla/xui-image-thumbnail';

<ImageThumbnail
  src="..."                    // Required: Image URL
  alt="Description"            // Alt text
  ratio="16:9"                 // Aspect ratio
  width={320}                  // Width
  overlay="fade"               // Overlay type
  centerContent={<PlayBtn />}  // Center content
  tagsTopLeft={<Tag />}        // Top-left tags
  tagsTopRight={<Tag />}       // Top-right tags
  tagsBottomLeft={<Tag />}     // Bottom-left tags
  tagsBottomRight={<Tag />}    // Bottom-right tags
  onPress={() => {}}           // Click handler
/>

API Reference

ImageThumbnail

A media thumbnail component with tag support.

ImageThumbnail Props:

| Prop | Type | Default | Description | | :--- | :--- | :------ | :---------- | | src | string | required | Image source URL. | | alt | string | "" | Alt text for the image. | | ratio | "1:1" \| "16:9" \| "4:3" \| "3:2" \| "2:3" \| "9:16" \| "custom" | "16:9" | Aspect ratio. | | customRatio | number | - | Custom aspect ratio (when ratio is 'custom'). | | width | number \| string | "100%" | Width of the thumbnail. | | height | number \| string | - | Fixed height (overrides ratio). | | borderRadius | number | 4 | Border radius in pixels. | | overlay | "none" \| "fade" \| "dark" | "fade" | Overlay type. | | centerContent | ReactNode | - | Content in the center (e.g., play button). | | tagsTopLeft | ReactNode | - | Tags in top-left corner. | | tagsTopRight | ReactNode | - | Tags in top-right corner. | | tagsBottomLeft | ReactNode | - | Tags in bottom-left corner. | | tagsBottomRight | ReactNode | - | Tags in bottom-right corner. | | onPress | () => void | - | Click handler. | | tagPadding | number | 8 | Padding for tag positions. | | tagGap | number | 4 | Gap between stacked tags. | | className | string | - | Custom className for the container. |

Overlay Types:

| Type | Description | | :--- | :---------- | | none | No overlay | | fade | Gradient fade from bottom (semi-transparent) | | dark | Solid dark overlay |

Aspect Ratio Values:

| Ratio | Numeric Value | Common Use | | :---- | :------------ | :--------- | | 1:1 | 1 | Square thumbnails | | 16:9 | 1.78 | Video, widescreen | | 4:3 | 1.33 | Standard photos | | 3:2 | 1.5 | DSLR photos | | 2:3 | 0.67 | Portrait | | 9:16 | 0.56 | Vertical video |

Theming

ImageThumbnail uses minimal theming, primarily relying on the passed props:

// Overlay styles
overlay="fade"  // linear-gradient(to top, rgba(0,0,0,0.48), transparent)
overlay="dark"  // rgba(0,0,0,0.48)

Accessibility

  • Uses semantic img element with alt text
  • Interactive when onPress is provided
  • Tags and center content can include accessible labels
  • Supports keyboard navigation when interactive