Skip to content

Avatar

Avatars are images used to represent users and organizations on GitHub. Use the default round avatar for users, and the square argument for organizations or any other non-human avatars.

Examples

Default

<%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>

Square

<%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser", square: true)) %>
<%= render(Primer::AvatarComponent.new(href: "#", src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>

Arguments

NameTypeDefaultDescription
srcStringN/AThe source url of the avatar image.
altStringN/APassed through to alt on img tag.
sizeInteger20Adds the avatar-small class if less than 24.
squareBooleanfalseUsed to create a square avatar.
hrefStringnilThe URL to link to. If used, component will be wrapped by an <a> tag.
system_argumentsHashN/ASystem arguments