Adapt UI Avatar
component provides a way to display profile pictures, initials or a
fallback icon to represent a user
import { Avatar } from "@adaptui/react-native-tailwind";
export default function App() {
return <Avatar src={{ uri: "https://i.pravatar.cc/300??img=39" }} />;
}
Adapt UI provides seven different sizes for Avatar, namely xs
, sm
, md
, lg
, xl
, 2xl
, and 3xl
/
import { Avatar, useTheme } from "@adaptui/react-native-tailwind";
export default function App() {
const tailwind = useTheme();
return (
<>
<Avatar size="xs" src={{ uri: "https://i.pravatar.cc/300??img=39" }}/>
<Avatar size="sm" src={{ uri: "https://i.pravatar.cc/300??img=39" }}/>
<Avatar size="md" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar size="lg" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar size="2xl" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar size="3xl" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
</>
);
}
Adapt UI provides four different options to convey the status for Avatar, namely active
, away
, sleep
, & typing
.
import { Avatar, useTheme } from "@adaptui/react-native-tailwind";
export default function App() {
const tailwind = useTheme();
return (
<>
<Avatar status="active" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar status="away" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar status="sleep" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar status="typing" src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
</>
);
}
Adapt UI provides two different options to style the Avatar, namely rounded and squared.
import { Avatar, useTheme } from "@adaptui/react-native-tailwind";
export default function App() {
const tailwind = useTheme();
return (
<>
<Avatar squared src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
<Avatar src={{ uri: "https://i.pravatar.cc/300??img=39" }} />
</>
);
}
Avatar implements Box accepting all
ViewProps
Name | Description | Type | Default |
---|---|---|---|
size | How large should avatar be? Defaults to 'md' | xs sm md lg xl 2xl 3xl |
xl |
src | The image src attribute | ImageSourcePropType from React Native |
|
imageProps | Image Props | ImageProps from React Native except source |
|
squared | If true, Avatar gets rounded corners | boolean | |
status | Shows AvatarBadge with the given type | active away sleep typing or null |
null |
parentsBackground | Color to match the background in StatusIndicator's Background Color & StatusIndicator Ring Color | string | |
name | Name prop used for alt & calculate placeholder initials. | string |