Socket
Socket
Sign inDemoInstall

@react-md/avatar

Package Overview
Dependencies
11
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @react-md/avatar

This package is used to avatars which are used to symbolize people or objects.


Version published
Maintainers
1
Install size
2.19 MB
Created

Changelog

Source

4.0.3 (2021-12-31)

Bug Fixes

  • @react-md/icon: FileInput default icon changed from file_download to file_upload (174d1c1), closes #1325
  • @react-md/table: Sortable Column Alignment (e447cc5), closes #1321
  • @react-md/utils: useIsUserInteractionMode get mode via context (b5f93ae), closes #1322
  • examples: Updated create-react-app README to use correct start command (37acdc3)

Other Internal Changes

  • Update tests to use jest.mocked (4bb25fb)
  • Updated all packages' peerDependenciesMeta (60fcd71), closes #1319
  • @react-md/dev-utils: Update watch command for new sass modules (2e7a87a)
  • examples: Update next to latest version (3521e9b)

Readme

Source

@react-md/avatar

Create avatars to represent people or objects with images, icons, or text. Different theme colors can also be applied for icons or text.

Installation

npm install --save @react-md/avatar

It is generally recommended to also install the following packages since they work hand-in-hand with this package:

npm install --save @react-md/theme \
  @react-md/typography \
  @react-md/list \
  @react-md/icon

Documentation

You should check out the full documentation for live examples and more customization information, but an example usage is shown below.

Usage

One of the main use-cases will probably be to display a list of people with specific avatars with them:

import { render } from "react-dom";
import { Avatar } from "@react-md/avatar";
import { List, ListItem } from "@react-md/list";

const people = [
  { name: "Logan Tyler", avatarUrl: "https://some-picture.com" },
  { name: "Trenton Berry", avatarUrl: "https://some-picture.com" },
  { name: "Damon Fletcher", avatarUrl: "https://some-picture.com" },
  { name: "Thomas Owen", avatarUrl: "https://some-picture.com" },
  { name: "Charity Henderson", avatarUrl: "https://some-picture.com" },
];

const App = () => (
  <List>
    {people.map(({ name, avatarUrl }, i) => (
      <ListItem
        id={`person-${i}`}
        key={i}
        leftAddon={<Avatar src={avatarUrl} alt={`${name}'s avatar'`} />}
        leftAddonType="avatar"
      >
        {name}
      </ListItem>
    ))}
  </List>
);

render(<App />, document.getElementById("root"));

Keywords

FAQs

Last updated on 01 Jan 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc