Avatar components are a huge part of our pages nowadays. From homepages to profile, the proliferation of round avatars everywhere. What would be the challenges of just adding an image in place?
I'm open sourcing a component that I have been using to work around these issues:
npm install @agney/react-avatar
# OR
yarn add @agney/react-avatar
Currently it requires React 16.8 or above and Styled Components v4 or above.
Styled Components is a dependency that I'm actively trying to abstract out.
import { Avatar } from "@agney/react-avatar";
import React from "react";
const App = () => {
return (
<Avatar
src="https://gravatar.com/avatar/7c4ff521986b4ff8d29440beec01972d?s=400&d=robohash&r=x"
text="CM"
/>
);
};
export default App;
For full documentation, visit Github Repository
Follow me on Twitter for updates.