Command palette

@yasinsensoy/native

React Native · Components

Avatar

Profile photo.

7 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

Code

import { Avatar } from "@yasinsensoy/native";

<Avatar src="https://github.com/yasinsensoy.png" name="Yasin Şensoy" status="online" tooltip="Yasin Şensoy · Online" />

Events

  1. Events appear here when you interact with the preview.

AvatarGroup: the rest as +N; names appear on hover

AYMK+2

Import

import { Avatar, AvatarGroup } from "@yasinsensoy/native";

Avatar

component

Profile photo. Shows the name's initials until the photo loads or if it fails; no layout shift, no broken image.

Avatar({ ref, src, name, icon, fallback, size: sizeProp, shape: shapeProp, status, effect, tooltip, style, }: AvatarProps): ReactNode

Examples

<Avatar src="https://…/jane.jpg" name="Jane Doe" />
<Avatar name="John Smith" size="lg" status="online" />

AvatarGroup

component

Overlapping row of avatars; those that do not fit are counted as "+N".

AvatarGroup({ items, max, size, style }: AvatarGroupProps): JSX.Element

Examples

`<AvatarGroup items={team} max={4} />`

Avatar size: 24, 32, 40, 48, 64 pixels (same as web).

type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl"

Online status: the colored dot in the corner.

type AvatarStatus = "online" | "away" | "busy" | "offline"

AvatarProps

interface

Props of Avatar.

NameTypeDefaultDescription
ref?Ref<ViewRef>Ref of the underlying native element.
src?string | ImageSourcePropType | nullPhoto: a URL or require("./photo.png"). If it fails to load, initials or an icon appear instead.
name?stringThe person's name: screen reader name and initials when there is no photo.
icon?IconPropIcon shown when there is neither a name nor a photo.
fallback?ReactNodeYour own fallback content (instead of the initials).
size?AvatarSize"md"Size. See AvatarSize.
shape?"circle" | "square""circle"Shape.
status?AvatarStatusStatus dot in the corner. See AvatarStatus.
effect?EffectPropEffect or effects ("pulse", "lift"…). Defaults to appearance.defaults.avatar.effect. See BuiltinEffect.
tooltip?TooltipPropTooltip shown on press and hold (e.g. the person's name). See TooltipProp.
style?StyleProp<ViewStyle>Container style.

A person in AvatarGroup.

NameTypeDescription
src?string | ImageSourcePropType | nullPhoto.
namestringName.
tooltip?TooltipPropTooltip shown on press and hold (e.g. name and role).

Props of AvatarGroup.

NameTypeDefaultDescription
itemsreadonly AvatarGroupItem[]People.
max?numberMaximum avatars shown; the rest are counted as "+3".
size?AvatarSize"md"Size.
style?StyleProp<ViewStyle>Container style.