Skip to content

fel1xw/react-robohash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

npm version Build Status Blazing Fast Coverage Status License: MIT gzip size Known Vulnerabilities

Install

npm install react-robohash --save
# or
yarn add react-robohash

Playground

You can play around with the module on codesandbox

Props

Name Type Required Default Description
name string true name, email, whatever identifier you want
alt string false Robohash-${name} alt property for image
className string false Robohash pass custom class
size string number false
type string number false robot
background string false 0 custom background set (1, 2)
fileType string false png image return type, png, svg, jpg (see homepage)
gravatar boolean false false checks if gravatar is available otherwise fallbacks to robot
children function false custom render prop function which gets only the url passed in (see example)

Usage

import Robohash from 'react-robohash';

<Robohash
  name="foxy"
  type="cat"
/>

or with custom element as render prop function

import Robohash from 'react-robohash';

<Robohash name="react-robohash">
  {url => <span>{url}</span>}
</Robohash>

Author

Support

If you like the project and want to support my work, you can think about buy me a coffee :)

paypal