Avatar

An image element with a fallback for representing the user.

Usage

import { Avatar } from '@smartacteam/react-native-ui';
<Avatar
  initials="AB"
  size_md
/>
<Avatar
  size_md
  image={require('...path/to/image.jpg')}
/>
<Avatar
  initials="CR"
  size_lg
  badge={...}
  badgeVerticalPosition="bottom"
  badgeHorizontalPosition="left"
/>

Props

NameTypeRequiredDescription
initialsstringNoFallback initials shown when image is not provided.
imageImageSourcePropTypeNoImage to be used in the avatar.
badgeVerticalPosition'top' | 'bottom'NoVertical placement of the badge. Default is 'top'.
badgeHorizontalPosition'left' | 'right'NoHorizontal placement of the badge. Default is 'right'.
badgeReact.ReactNodeNoA React node rendered as a badge overlay.
size_*booleanNoOne of the size keys, like size_sm, size_md, size_lg, etc.
(…)(Inherited)Props from BaseSmacStyling, ViewProps.

Size is inferred by any size_* boolean passed to the component. If no size is passed, it defaults to size_md.

See BaseSmacStyling, BaseSmacTextStyling, and React Native View Props for inherited options.