Socket
Socket
Sign inDemoInstall

pravatar

Package Overview
Dependencies
8
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pravatar

React Avatar component make it possible to show image as well as placeholder text


Version published
Maintainers
1
Install size
25.6 kB
Created

Readme

Source

Pravatar

Avatar Placeholder

NPM JavaScript Style Guide

React pravatar component preview

For the moment we support following types:

  • Any String
  • Custom image
  • Name initials

Install

npm install --save pravatar

# besides React, react-avatar also has prop-types as peer dependency,
# make sure to install it into your project
$ npm install prop-types --save

Usage

import React, { Component } from "react";

import Pravatar from "pravatar";

class Example extends Component {
  render() {
    return (
      <Pravatar
        text=""
        image="https://avatars1.githubusercontent.com/u/17858766?s=88&v=4"
        width="100px"
        height="100px"
        radius="100px"
        fontSize="50px"
        bg="#e7e7e7"
        textColor="#000"
        border="1px solid black"
        position="center"
        size="cover"
        weight="bold"
      />
    );
  }
}

Options

Avatar

AttributeOptionsDefaultDescription
textstringemptyAny String
imagestringemptyImage avatar to use
textColorstringinheritset the color of text
sizestringcoverset the background image size
positionstringcenterset the background image position
weightstringnormalset the font weight
fontSizestringinheritset the font size
borderstringnoneset the border of the avatar
radiusstring100pxset the border radius of the avatar
heightstring50pxset the height of the avatar
widthstring50pxset the width of the avatar
bgstringinheritTo set the background color of the avatar
initialbooleanfalseWill be used to generate avatar based on the initials of the person

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License

Keywords

FAQs

Last updated on 10 May 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc