Skip to content

Avatar

User profile images in circular or square shapes.

Source: src/styles/components/avatar.scss
Demo: not in index.html yet
JavaScript required: No

Note: Avatar is included in the build as of the next release. Rebuild with npm run build after pulling latest source.


HTML

html
<div class="dga-avatar" data-size="md">
  <img src="user.jpg" alt="User name" />
</div>

Preview

User name
User name

Sizes

data-sizeDimensions
xs24px
sm32px
md40px
lg48px
xl64px
2xl80px
3xl120px
html
<div class="dga-avatar" data-size="lg">
  <img src="avatar.png" alt="" />
</div>

Preview


Shape

AttributeShape
(default) / data-square="false"Circle
data-square="true"Rounded square (4px radius)
html
<div class="dga-avatar" data-size="md" data-square="true">
  <img src="logo.png" alt="Organization" />
</div>

Preview

Circle avatar
Square avatar

Styling

  • White 2px border
  • object-fit: cover on images
  • overflow: hidden

Enable in build

Avatar is imported in src/styles/main.scss. Run npm run build to include styles in dist/style.css.


MIT Licensed — Wael Alghamdi