npm install react-robohash --save
# or
yarn add react-robohash
You can play around with the module on codesandbox
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) |
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>
- Felix Wostal @felixwostal
If you like the project and want to support my work, you can think about buy me a coffee :)