Responsive and customizable search and select for Giphy's GIFs and Stickers.

Overview

React Giphy Searchbox Logo

Responsive and customizable search and select for Giphy's GIFs.

https://sergiop.github.io/react-giphy-searchbox/


Travis npm package Codecov


React Giphy Searchbox is a powerful react component that returns Giphy's GIF or Stickers in a Masonry grid layout. Initially the component displays trending GIFs from Giphy's feed, when the the user starts typing something in the search field it switches to searched results. When an image is selected, a GIF object is returned.

React Giphy Searchbox preview


Please note: Axios has been dropped in favor of the native window.fetch() method from version 1.3.0. Please keep in mind that if you need to support old browsers you have to add a global polyfill like github/fetch or developit/unfetch.


Demo

Play with a simple responsive demo on CodeSandbox

Edit react-giphy-searchbox

Getting started

Installation

yarn add react-giphy-searchbox
npm install react-giphy-searchbox --save

Basic example

import React from 'react'
import { render } from 'react-dom'
import ReactGiphySearchbox from 'react-giphy-searchbox'

const App = () => (
  <ReactGiphySearchbox
    apiKey="YOUR_API_KEY" // Required: get your on https://developers.giphy.com
    onSelect={item => console.log(item)}
  />
)

render(<App />, document.getElementById("root"))

Props

Prop Type Desc ß
apiKey string REQUIRED: Giphy's API key. Get your on https://developers.giphy.com.
onSelect function REQUIRED A callback which is triggered whenever a GIF is selected. It returns a Gif object in the format specified for an image from Giphy's API.
onSearch function A callback which is triggered whenever a search is performed. It returns the searched text string.
libray `'gifs' 'stickers'`
rating string Filters results by specified rating.
Default: g
imageRenditionName string The type of rendition to be used.
Default: fixed_width_downsampled.
Please be careful with this setting, loading high quality gifs inside the masonry can reduce the performances.
imageRenditionFileType `'gif' 'webp'`
gifPerPage number The maximum number of images to return per page.
Default: 20
autoFocus boolean If true, the search form input field is focused by default on startup.
Default: false
masonryConfig array An array of objects describing the masonry's properties at different breakpoints. See specific chapter for further info.
Default: [{ columns: 2, imageWidth: 120, gutter: 5 }]
gifListHeight string The height of the returned GIF list.
Default: 300px
messageError string Generic error message when APIs call fails.
Default: Oops! Something went wrong. Please, try again.
messageLoading string Loading message only for accessibility purposes.
Default: Loading...
messageNoMatches string Message to tell users searched string returned empty array.
Default: No matches found.
loadingImage string If you want to customize the loading spinner, use this prop to set an alternative src for the image.
poweredByGiphy boolean You can choose to display or not display the Powered by Giphy badge at the bottom. Note that you need to show it if you want a production Api key from Giphy.
Default: true
poweredByGiphyImage string If you want to customize the Powered by Giphy badge, use this prop to set an alternative src for the image.
searchPlaceholder string Search input placeholder.
Default: Search for GIFs
wrapperClassName string Additional CSS class for the <div> that wrap the whole component.
searchFormClassName string Additional CSS class for the <form> element.
listWrapperClassName string Additional CSS class for the <div> that wrap the GIFs list.
listItemClassName string Additional CSS class for the <button> that wrap the single image.
imageBackgroundColor string Set the Giphy's image item background color, useful when libray prop is set to stickers, since stickers have transparent background.
Default: #eee

Responsive options

masonryConfig prop allow you to define responsiveness of the component. This prop accept an array of objects describing the masonry's properties at different breakpoints.

Each object in the array has the following properties:

Prop Type Description
mq string The minimum viewport width
columns number The number of vertical columns
imageWidth number The width (in px) of the image, and consequentially of the column
gutter number The space (in px) between the columns
[
  { columns: 2, imageWidth: 140, gutter: 10 },
  { mq: '700px', columns: 3, imageWidth: 200, gutter: 10 },
  { mq: '1000px', columns: 4, imageWidth: 220, gutter: 10 },
]

When defining your properties, note the following:

  • properties must be listed smallest to largest breakpoints in a mobile first approach;
  • The size without the mq property is assumed to be your smallest breakpoint, and must appear first.

License

MIT. © 2021 Sergio Pedercini

Comments
  • Bump express from 4.17.1 to 4.18.2

    Bump express from 4.17.1 to 4.18.2

    Bumps express from 4.17.1 to 4.18.2.

    Release notes

    Sourced from express's releases.

    4.18.2

    4.18.1

    • Fix hanging on large stack of sync routes

    4.18.0

    ... (truncated)

    Changelog

    Sourced from express's changelog.

    4.18.2 / 2022-10-08

    4.18.1 / 2022-04-29

    • Fix hanging on large stack of sync routes

    4.18.0 / 2022-04-25

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump qs from 6.2.3 to 6.2.4

    Bump qs from 6.2.3 to 6.2.4

    Bumps qs from 6.2.3 to 6.2.4.

    Changelog

    Sourced from qs's changelog.

    6.2.4

    • [Fix] parse: ignore __proto__ keys (#428)
    • [Fix] utils.merge: avoid a crash with a null target and an array source
    • [Fix] utils.merge: avoid a crash with a null target and a truthy non-array source
    • [Fix] utils: merge: fix crash when source is a truthy primitive & no options are provided
    • [Fix] when parseArrays is false, properly handle keys ending in []
    • [Robustness] stringify: avoid relying on a global undefined (#427)
    • [Refactor] use cached Array.isArray
    • [Docs] Clarify the need for "arrayLimit" option
    • [meta] fix README.md (#399)
    • [meta] Clean up license text so it’s properly detected as BSD-3-Clause
    • [meta] add FUNDING.yml
    • [actions] backport actions from main
    • [Tests] use safer-buffer instead of Buffer constructor
    • [Tests] remove nonexistent tape option
    • [Dev Deps] backport from main
    Commits
    • 90d9f2b v6.2.4
    • ba24e74 [Fix] parse: ignore __proto__ keys (#428)
    • f047c9d [Dev Deps] backport from main
    • 5f8e28b [actions] backport actions from main
    • 2c38654 [Robustness] stringify: avoid relying on a global undefined (#427)
    • 37e176d [meta] fix README.md (#399)
    • 081a3ab [Tests] use safer-buffer instead of Buffer constructor
    • 943e411 [meta] Clean up license text so it’s properly detected as BSD-3-Clause
    • 0d82916 [Fix] utils.merge: avoid a crash with a null target and an array source
    • c103b90 [Fix] utils.merge`: avoid a crash with a null target and a truthy non-array...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump decode-uri-component from 0.2.0 to 0.2.2

    Bump decode-uri-component from 0.2.0 to 0.2.2

    Bumps decode-uri-component from 0.2.0 to 0.2.2.

    Release notes

    Sourced from decode-uri-component's releases.

    v0.2.2

    • Prevent overwriting previously decoded tokens 980e0bf

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.1...v0.2.2

    v0.2.1

    • Switch to GitHub workflows 76abc93
    • Fix issue where decode throws - fixes #6 746ca5d
    • Update license (#1) 486d7e2
    • Tidelift tasks a650457
    • Meta tweaks 66e1c28

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump node-fetch from 2.6.1 to 2.6.7

    Bump node-fetch from 2.6.1 to 2.6.7

    Bumps node-fetch from 2.6.1 to 2.6.7.

    Release notes

    Sourced from node-fetch's releases.

    v2.6.7

    Security patch release

    Recommended to upgrade, to not leak sensitive cookie and authentication header information to 3th party host while a redirect occurred

    What's Changed

    Full Changelog: https://github.com/node-fetch/node-fetch/compare/v2.6.6...v2.6.7

    v2.6.6

    What's Changed

    Full Changelog: https://github.com/node-fetch/node-fetch/compare/v2.6.5...v2.6.6

    v2.6.2

    fixed main path in package.json

    Commits
    • 1ef4b56 backport of #1449 (#1453)
    • 8fe5c4e 2.x: Specify encoding as an optional peer dependency in package.json (#1310)
    • f56b0c6 fix(URL): prefer built in URL version when available and fallback to whatwg (...
    • b5417ae fix: import whatwg-url in a way compatible with ESM Node (#1303)
    • 18193c5 fix v2.6.3 that did not sending query params (#1301)
    • ace7536 fix: properly encode url with unicode characters (#1291)
    • 152214c Fix(package.json): Corrected main file path in package.json (#1274)
    • See full diff in compare view
    Maintainer changes

    This version was pushed to npm by endless, a new releaser for node-fetch since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Update npm package with last fix

    Update npm package with last fix

    This last commit that fixed the module.hot dependency should be pushed to npm and a new path/minor version

    https://github.com/sergiop/react-giphy-searchbox/pull/64

    opened by arekucr 0
  • Don't nest search input in form

    Don't nest search input in form

    Love the component!

    But I'd suggest taking out form as I had trouble earlier today where this giphy component was already inside a form and that caused the page to reload everytime I pressed enter in the search box. (if form is not doing anything major ofc, then we can take it out).

    opened by pranavmalvawala 0
Releases(v1.5.4)
Responsive React Repository Search

React Repository Search A repository search application using Github's repository search API that displays results based on search terms. The results

Hemesh Patel 6 Oct 2, 2022
This is a react app that I created for an intern test, involves using a search and price filter features

FRONTEND ENGINEERING INTERN APPLICATION This is an application i created for an intern application test. VIEW APP Available Scripts In the project dir

Kehinde Ojapa 1 Nov 4, 2021
A unique search bar that filters through data. Built with React, JavaScript, Material UI, Node.js and MySQL

A unique search bar that filters through data. Built with React, JavaScript, Material UI, Node.js and MySQL

Christotle Agholor 4 Nov 22, 2022
GitHub repository search app in React, TypeScript and GraphQL

GitHub repository search app in React, TypeScript and GraphQL

Hesbon Osoro 3 Dec 21, 2022
Hypersearch enhances all major search engines (Google, DuckDuckGo, Amazon, etc.) with results from trusted sources in the sidebar and removing results from blocked sources

Hypersearch Coming soon for Firefox and Opera. Microsoft Edge users can install from the Chrome store. Hypersearch enhances all major search engines (

Abhinav Sharma 62 Dec 28, 2022
Redux bindings for client-side search

redux-search Higher-order Redux library for searching collections of objects. Search algorithms powered by js-worker-search. Check out the live demo a

Brian Vaughn 1.4k Dec 16, 2022
Elegant, accessible search component for React.

Elegant, accessible search component for React with recent searches & current location functionality. Installation npm i react-find --save Usage impo

George B. 20 Aug 19, 2022
React Typesense Search 10,000 Trending Movies using Instantsearch

Getting Started with Create React App This project was bootstrapped with Create React App. Demo Available Scripts In the project directory, you can ru

Islem Maboud 14 Nov 24, 2022
Pokedex - Search for Pokémon by name or using the National Pokédex number

Pokédex ?? Tecnologias utilizadas Esse projeto foi desenvolvido com as seguintes

Wellington Garcia 20 Sep 12, 2022
A React Typescript search interface for the popular Giphy.com service.

giphy-search A React Typescript search interface for the popular Giphy.com service. Lets get to it Scope We want you to create a search interface for

null 1 May 18, 2022
🔍 GitHub repository search for Tonik

Tonik Project for Tonik. Project is about creating a simple GitHub repository search tool. I am using following technologies: TypeScript, HTML5. Code

Tomasz Adamczyk 3 Dec 21, 2022
Code Search in natural language for React codebases [JS/TS]. Provided by Wizi AI.

AI powered Code Search for React codebases (JS/TS) by Wizi AI We are launching our Code Search feature as an open-source project for frontend teams to

Wizi HQ 26 Feb 28, 2023
A customizable countdown component for React.

React <Countdown /> A customizable countdown component for React. Getting Started Motivation Examples Props API Reference Helpers FAQ Contributing Lic

Martin V. 629 Jan 9, 2023
A React JS project to make age and gender prediction using Agify.io and Genderize.io. Only for practice use and just for fun~

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Ken Tandrian 2 Nov 1, 2022
HTML meta tags for React-based apps. Works for both client- and server-side rendering, and has a strict but flexible API.

React Document Meta HTML meta tags for React-based apps. Works for both client- and server-side rendering, and has a strict but flexible API. Built wi

kodyl 320 Nov 18, 2022
A starter for React with Typescript with the fast Vite and all static code testing with Eslint and formatting with Prettier.

A starter for React with Typescript with the fast Vite and all static code testing with Eslint and formatting with Prettier.

The Sword Breaker 315 Dec 30, 2022
An interactive CLI automation tool 🛠️ for creating react.js and next.js projects most fast and efficiently. ⚛️

An interactive CLI automation tool ??️ for creating react.js and next.js projects most fast and efficiently. ⚛️

Alexis Guzman 27 Apr 12, 2022
Open source authentication and authorization service, container-native, PassportJS-native, built with React and Node.

id6 Authentication and authorization as a service Docs - Twitter Why id6 ? I wrote id6 out of frustration of re-writing authentication and authorizati

id6 12 Oct 31, 2021
React project with Google Firebase API, create partys with admin view and user view. Users can ask topics to admin, and support other topics.

?? Tecnologias Esse projeto foi desenvolvido com as seguintes tecnologias: React Firebase TypeScript ?? Como executar Clone o projeto e acesse a pasta

Felipe Souza 3 Aug 27, 2021