0.1.3 • Published 3 years ago

@hashup/react-simple-avatar v0.1.3

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

@hashup/react-simple-avatar

A simple React avatar component to display either their avatars or their initials

View DEMO

NPM JavaScript Style Guide

Install

npm install --save @hashup/react-simple-avatar

Usage

//
// React class
//
import React, { Component } from 'react'

import Avatar from '@hashup/react-simple-avatar'
import '@hashup/react-simple-avatar/dist/index.css'

class Example extends Component {
  render() {
    return <Avatar name="Denis" />
  }
}

//
// React function
//
import React, { Component } from 'react'

import Avatar from '@hashup/react-simple-avatar'
import '@hashup/react-simple-avatar/dist/index.css'

const MyApp = () => {
  return <Avatar name="Denis" />
}

Attributes

NameDefaultTypeDescription
name""StringName of the person
avatarUrl""StringURL for the avatar (will revert to color and initial if image can't load)
className""StringAdd your own CSS class name to the wrapper
size50NumberSize in pixels of the avatar
borderRadius50%StringBorder radius of the avatar in pixels
backgroundColor"#8E8E8E"StringBackground color for initials
textColor"#F1F1F1"StringText color for the initials
enableTooltiptrueBoolEnable tooltips on mouse over of the avatar
tooltipDirection"top"StringOptions: top, bottom, left, right
tooltipTextColor"#FFFFFF"StringText color for the tooltip
tooltipBackgroundColor"#000000"StringBackground color for the tooltip
tooltipMargin30NumberOffset of the tooltip
tooltipArrowSize6NumberSize of the arrow
tooltipDelay200NumberDelay before the tooltip appears
style{}ObjectPass custom styles to the wrapper

License

MIT © desduvauchelle

Notes to self

To publish on npm:

npm publish
0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago