0.0.3 • Published 6 months ago

astro-ui-avatars v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

🧔 Astro UI Avatars

version downloads github actions typescript makepr

This Astro package provides a component to generate user avatars with initials from names.

📦 Installation

Install using pnpm:

pnpm add astro-ui-avatars

Or using npm:

npm install astro-ui-avatars

Or using yarn:

yarn add astro-ui-avatars

🥑 Usage

To generate a user avatar in any of your Astro pages or components, import the Avatar component from astro-ui-avatars and use it inside your HTML:

---
import { Avatar } from "astro-ui-avatars"
---

<html lang="en">
  <body>
    <p>User Avatar:</p>
    <Avatar name="John Doe" />
  </body>
</html>

🎨 Examples

  • Generate an avatar with default settings
<Avatar name="John Doe" />
  • Generate a blue avatar
<Avatar background="#0D8ABC" color="#fff" />
  • Generate a random background avatar
<Avatar background="random" />
  • Generate a rounded avatar
<Avatar rounded={true} />

📖 API Reference

NameRequiredDefaultDescription
namefalseJohn DoeThe name used to generate initials.
sizefalse64The size of the avatar in pixels.
backgroundfalse#007bffThe background color of the avatar.
colorfalse#FFFFFFThe text color of the avatar.
lengthfalse2The number of initials to display.
fontSizefalse0.5The font size of the initials in percentage. Between 0.1 and 1.
roundedfalsetrueWhether the avatar should have rounded corners.
uppercasefalsetrueWhether the initials should be in uppercase.
boldfalsetrueWhether the initials should be bold.

All Avatar props are optional. If no props are provided, the avatar will use default settings.

Note

We have also setup an example repository available here: playground

Changelog

Please see the changelog for more information on recent changes.

Acknowledgements

Astro UI Avatars is heavily inspired by ui-avatars.com. Thanks ❤️

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago