Skip to content

ssi02014/react-thumbnail-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ป react-thumbnail-generator

English | ํ•œ๊ตญ์–ด | ็ฎ€ไฝ“ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž

Overview ๐ŸŽจ

react-thumbnail-generator is a versatile React component that allows you to easily create and customize thumbnails directly in your web browser. With an intuitive interface and rich feature set, you can generate thumbnails for your projects without leaving your application.

2025-07-25.1.28.20.mov

Key Features

  • ๐ŸŽฏ Simple drag & drop interface
  • ๐ŸŽจ Background color/image customization
  • โœ๏ธ Text styling with multiple fonts and effects
  • ๐Ÿ“ Flexible canvas sizing
  • ๐Ÿ–ผ๏ธ Multiple export formats (PNG, JPG, WebP)
  • ๐Ÿ”ง Highly configurable positioning and appearance
  • ๐Ÿ“ฑ Desktop browser optimized
  • ๐Ÿ“ฑ Client-side only component

Demo Page ๐Ÿ–ผ๏ธ

react-thumbnail-generator demo page


Version Compatibility ๐Ÿ”„

react-thumbnail-generator v4 supports react/react-dom v19 and above.

If you are using react 18 or below, please use version v3.4.0.

yarn add react-thumbnail-generator@^3.4.0
pnpm add react-thumbnail-generator@^3.4.0
npm install react-thumbnail-generator@^3.4.0

Quick Start ๐Ÿš€

STEP 1๏ธโƒฃ

  • Install Package
yarn add react-thumbnail-generator
pnpm add react-thumbnail-generator
npm install react-thumbnail-generator

STEP 2๏ธโƒฃ

  • Add <ThumbnailGenerator> component.
  • ThumbnailGenerator is automatically rendered as a document.body child by default using Portal.
import ThumbnailGenerator from 'react-thumbnail-generator';

const App = () => {
  return (
    <ThumbnailGenerator
      iconPosition="bottom-right"
      // Specify the position of the toggle button icon (top-left, top-right, bottom-left, bottom-right)

      modalPosition="right"
      // Specifies the position where the thumbnail generator will be displayed (left, right, center)

      iconSize="medium" 
      // Sets the size of the toggle button icon (small, medium, large)

      additionalFontFamily={['Noto Sans', ...]}
      // Add custom fonts to use in the generator
      // Important: Fonts must be already loaded in your project to work

      isFullWidth={true}
      // Makes the thumbnail generator expand to full width when true

      isDefaultOpen={false}
      // Opens the thumbnail generator automatically on load when true
    />
  )
}

How to add Web Fonts ๐Ÿ˜Š

STEP 1๏ธโƒฃ

  • Add a web font in public/index.html or index.html
  • Or import web fonts in your CSS/SCSS files
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- ... -->
    <!-- Add a web font -->
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link
      href="https://fonts.googleapis.com/css2?family=Zeyada&display=swap"
      rel="stylesheet"
    />
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

STEP 2๏ธโƒฃ

  • Add font names as an array to the additionalFontFamily prop
  • The font names must match exactly with the loaded web fonts
import ThumbnailGenerator from 'react-thumbnail-generator';

const App = () => {
  return (
    <ThumbnailGenerator additionalFontFamily={["Zeyada"]} {...props} />
  )
}

Options ๐Ÿ“„

  • iconPosition
    • Optional
    • Default: bottom-right
    • Type:top-left | top-right | bottom-left | bottom-right
  • modalPosition
    • Optional
    • Default: right
    • Type:left | right | center
  • iconSize
    • Optional
    • Default: medium
    • Type: small | medium | large
  • additionalFontFamily
    • Optional
    • Type: string[]
  • isFullWidth
    • Optional
    • Default: false
    • Type: boolean
  • isDefaultOpen
    • Optional
    • Default: false
    • Type: boolean

Contributing

Thank you for your contribution. โค๏ธ Anyone can contribute to react-thumbnail-generator.


License

MIT ยฉ ssi02014. See LICENSE for details.