monday-ui-react-core
Version:
Official monday.com UI resources for application development in React.js
167 lines (121 loc) • 4.79 kB
text/mdx
import Avatar from "../Avatar";
import { Canvas, Meta } from "@storybook/blocks";
import {
AVATAR_GROUP,
BADGE,
TOOLTIP
} from "../../../storybook/components/related-components/component-description-map";
import { ComponentRules, createComponentTemplate } from "vibe-storybook-components";
import { femaleIcon, maleIcon, person1, person2, person3 } from "./assets";
import { TipMultipleAvatarsTogether } from "./Avatar.stories.helpers";
import * as AvatarStories from "./Avatar.stories";
<Meta of={AvatarStories} />
export const avatarTemplate = createComponentTemplate(Avatar);
- [Overview](
- [Props](
- [Usage](
- [Variants](
- [Do’s and don’ts](
- [Use cases and examples](
- [Related components](
- [Feedback](
Avatar is a graphical representation of a person through a profile picture, image, icon, or set of initials.
<Canvas of={AvatarStories.Overview} />
<PropsTable />
<UsageGuidelines
guidelines={[
"Use an avatar to help a user in the platform efficiently identify another person or a team.",
"When there is no personal photo to show, use initials.",
"If an image fails to load, fall back to the default user avatar.",
"An avatar may contain a status icon to indicate a user’s status (working from home, busy, etc.).",
"Use a tooltip or dialog when hovering over the avatar to offer more information. For example: with a person’s name."
]}
/>
<TipMultipleAvatarsTogether />
Avatars appear in 3 sizes: Small, Medium, and Large.
<Canvas of={AvatarStories.Size} />
Use when a user is inactive in the system.
<Canvas of={AvatarStories.Disable} />
Use when a user’s image is not available, use their initials.
<Canvas of={AvatarStories.AvatarWithText} />
Use for non-person avatars, such as a workspace or team.
<Canvas of={AvatarStories.SquareAvatar} />
<ComponentRules
rules={[
{
positive: {
component: (
<div className="monday-storybook-avatar_multiple">
<Avatar className="multiple-avatar" size={Avatar.sizes.LARGE} src={person1} type={Avatar.types.IMG} />
<Avatar className="multiple-avatar" size={Avatar.sizes.LARGE} src={person2} type={Avatar.types.IMG} />
<Avatar className="multiple-avatar" size={Avatar.sizes.LARGE} src={person3} type={Avatar.types.IMG} />
</div>
),
description: "Use consistent avatar sizes for common use cases to convey their purpose."
},
negative: {
component: (
<div className="monday-storybook-avatar_multiple-reverse">
<Avatar
className="multiple-reverse-avatar"
size={Avatar.sizes.SMALL}
src={person1}
type={Avatar.types.IMG}
/>
<Avatar
className="multiple-reverse-avatar"
size={Avatar.sizes.MEDIUM}
src={person2}
type={Avatar.types.IMG}
/>
<Avatar
className="multiple-reverse-avatar"
size={Avatar.sizes.LARGE}
src={person3}
type={Avatar.types.IMG}
/>
</div>
),
description: "Avoid using a mix of avatar sizes that display together and create design imbalance."
}
},
{
positive: {
component: <Avatar src={maleIcon} type={Avatar.types.IMG} />,
description: "Use branded generic avatars when a user has not set their avatar image."
},
negative: {
component: <Avatar src={femaleIcon} type={Avatar.types.IMG} />,
description: "Don’t make assumptions and use gendered placeholder avatars."
}
}
]}
/>
Use to indicate the user’s permissions such as: Guest, owner.
<Canvas of={AvatarStories.AvatarWithRightBadge} />
Use to indicate the status of a user such as: Working from home, out of office etc.
<Canvas of={AvatarStories.AvatarWithLeftBadge} />
Use to display tooltip on onHover Avatar event.
<Canvas of={AvatarStories.AvatarWithTooltip} />
Use to fire actions on avatar click event.
<Canvas of={AvatarStories.ClickableAvatar} />
To group multiple Avatars together, use the <StorybookLink page="Media/Avatar/AvatarGroup">AvatarGroup</StorybookLink> component.
<Canvas of={AvatarStories.MultipleAvatars} />
<RelatedComponents componentsNames={[AVATAR_GROUP, TOOLTIP, BADGE]} />