Avatar Group B

Group of avatar images

Preview

Jane Forester
Jane Forester
Jane Forester
Jane Forester
+2
Jane Forester
Jane Forester
Jane Forester
Jane Forester
+2

Code

import styles from "./avatar-group-b.module.css"; type Props = { className?: string; children?: React.ReactNode; direction?: "to-right" | "to-left"; size?: "small" | "medium" | "large"; avatar1Element?: React.ReactNode; avatar2Element?: React.ReactNode; }; export default function AvatarGroupB({ className, children, direction, size="medium", avatar1Element, avatar2Element, }: Props) { return ( <div className={className}> <div className={[styles["wrapper"], styles[`s-${size}`]].join(" ")}> <div className={[styles["avatars"], styles[`d-${direction}`]].join(" ")} > <div className={styles["avatar-1"]}> <div className={styles["avatar-item"]}>{avatar1Element}</div> </div> <div className={styles["avatar-2"]}> <div className={styles["avatar-item"]}>{avatar2Element}</div> </div> </div> {children && <div className={styles["content"]}>{children}</div>} </div> </div> ); }

Design

Figma design file:

Documentation

Properties

Props of the component:

  • className (string): Specifies the CSS class of the component.
  • children (ReactNode): React children of the component. Specifies the ReactNode placed inside the component.
  • direction ("to-right" | "to-left"): Specifies the direction of placement order of avatar components.
  • size ("small" | "medium" | "large"): Specifies the size of the component.
  • avatar1Element (ReactNode such as the Avatar A component): Specifies the first avatar component of the group.
  • avatar2Element (ReactNode such as the Avatar A component): Specifies the second avatar component of the group.