boring-avatars

repository·master·Indexed 27 days ago

https://github.com/boringdesigners/boring-avatars

A tiny JavaScript React library that generates custom, SVG-based, round avatars from any username and color palette. It features multiple visual variants including marble, beam, pixel, sunset, ring, and bauhaus, and supports customization of size, colors, and shape.

Tokens
837
Snippets
6
Records
10
Agent score
42%

What's inside boring-avatars

  1. Configure Avatar component props

    master

    The Avatar component accepts several props to customize the appearance of the generated avatar:

    • name (string): The seed used to generate the avatar. Defaults to Clara Barton.
    • variant (oneOf: marble, beam, pixel, sunset, ring, bauhaus): Changes the visual theme. Defaults to marble.
    • size (number | string): Sets the dimensions. Defaults to 40px.
    • colors (array): An array of color strings to define the palette.
    • square (boolean): If true, renders a square avatar instead of circular. Defaults to false.
    • title (boolean): Enables a title attribute. Defaults to false.
  2. Use the Avatar component

    master

    The Avatar component is the primary entrypoint for generating various avatar styles. It accepts a variant to choose the visual style, a colors array for the color palette, and a name for seed-based generation.

    Available variants include:

    • pixel
    • bauhaus
    • ring
    • beam
    • sunset
    • marble

    Note: geometric is deprecated (use beam) and abstract is deprecated (use bauhaus).

  3. Configure AvatarProps

    master

    The Avatar component accepts the following props:

    PropTypeDefaultDescription
    variantkeyof typeof AVATAR_VARIANTS'marble'The visual style of the avatar.
    colorsstring[]['#92A1C6', '#146A7C', '#F0AB3D', '#C271B4', '#C20D90']An array of hex color strings used for the generation.
    namestring'Clara Barton'The name used to seed the avatar generation.
    titlebooleanfalseWhether to include a title.
    sizestring'40px'The dimensions of the avatar.
    squarebooleanfalseWhether to render the avatar as a square instead of a circle.