Packages
React

Aptos Avatars React

Implementation of the Aptos Avatars shape library for React applications.

Installation

npm install aptos-avatars-react

How to Use

The avatar compoennt can be imported as a React component which renders an inline SVG element. If you choose to use a single shape, you can import the shape avatars directly. The package is built with ES Modules so the rest of the package will be tree-shaken out of your bundle.

import { AptosAvatar, AptosCoinAvatar, Shape2 } from "aptos-avatars-react";
 
// Usage
const App = () => {
  return (
    <div>
      <AptosCoinAvatar value="0xd2cf...cff23" border />
      <AptosAvatar value="0xd2cf...cff23" border shadow />
      <Shape2 value="0xd2cf...dff23" />
    </div>
  );
};
 
export default App;

Props

nametypedefaultdescription
value*stringrequiredUnique identifier for the user (e.g., address or Aptos Name) to randomly generate a shape and color
sizenumber32Size of the icon
shadowbooleanfalseToggle the border
borderbooleanfalseToggle the shadow
borderSizenumber2Width of the border, in pixels
borderColorstring#fffColor of the border
radiusnumbersizeBorder radius of the avatar, in pixels
displayValuestringN/AValue to be displayed on the avatar instead of value. This can be a name instead of an identifier
style"character" | "shape""character"Style of the avatar (either "character" or "shape")

Examples

Li

Ol

Em

No

So

Av

Is

Mi

Ch

Li

Ol

Em

Ph