@gluestack-ui/avatar
TypeScript icon, indicating that this package has built-in type declarations

0.1.16 • Public • Published

@gluestack-ui/avatar

Installation

To use @gluestack-ui/avatar, all you need to do is install the @gluestack-ui/avatar package:

$ yarn add @gluestack-ui/avatar

# or

$ npm i @gluestack-ui/avatar

Usage

The Avatar component is a versatile UI element representing a user with profile pictures, initials, or a fallback icon. It adds a personal touch to the user interface, making it more engaging. Here's an example how to use this package to create one:

import {
  Root,
  Badge,
  Group,
  Image,
  FallbackText,
} from '../components/core/avatar/styled-components';
import { createAvatar } from '@gluestack-ui/avatar';
const Avatar = createAvatar({
  Root,
  Badge,
  Group,
  Image,
  FallbackText,
});

Customizing the avatar:

Default styling of all these components can be found in the components/core/avatar file. For reference, you can view the source code of the styled avatar components.

// import the styles
import {
  Root,
  Badge,
  Group,
  Image,
  FallbackText,
} from '../components/core/avatar/styled-components';

// import the createAvatar function
import { createAvatar } from '@gluestack-ui/avatar';

// Understanding the API
const Avatar = createAvatar({
  Root,
  Badge,
  Group,
  Image,
  FallbackText,
});

// Using the avatar component
export default () => (
  <AvatarGroup>
    <Avatar>
      <AvatarFallbackText />
      <AvatarBadge />
    </Avatar>
  </AvatarGroup>
);

More guides on how to get started are available here.

Package Sidebar

Install

npm i @gluestack-ui/avatar

Weekly Downloads

10,967

Version

0.1.16

License

none

Unpacked Size

48.3 kB

Total Files

51

Last publish

Collaborators

  • vaibhk002
  • daminipandey
  • rayan1810
  • amars29
  • geekgautam
  • gluestackadmin
  • geekashwini
  • vidhi499
  • mayankp06
  • madhavb230100
  • viraj-10
  • rohit_singh
  • ankit-tailor
  • meenumakkar
  • surajahmedc