Socket
Socket
Sign inDemoInstall

@gluestack-ui/avatar

Package Overview
Dependencies
1
Maintainers
15
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gluestack-ui/avatar

A universal headless avatar component for React Native, Next.js & React


Version published
Weekly downloads
9.2K
decreased by-2.62%
Maintainers
15
Created
Weekly downloads
 

Readme

Source

@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.

Keywords

FAQs

Last updated on 03 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc