
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@leafygreen-ui/avatar
Advanced tools
pnpm add @leafygreen-ui/avatar
yarn add @leafygreen-ui/avatar
npm install @leafygreen-ui/avatar
// Text
return <Avatar format={Format.Text} text="AT" size={AvatarSize.Large} />;
// Icon
return <Avatar format={Format.Icon} glyph="PersonGroup" />;
// Logo
return <Avatar format={Format.MongoDB} sizeOverride={56} />;
// Assistant
return <AssistantAvatar size={AvatarSize.Large} />;
Prop | Type | Description | Default |
---|---|---|---|
darkMode | boolean | Determines if the component will render in dark mode | false |
size | "default" , "large" , "xlarge" | Determines the size of the avatar | "default" |
sizeOverride | number | If provided, overrides the size prop to a customizable number (in px) | |
format | "mongo" , "user" , "default" | Determines the Avatar component's variant | "default" |
text | string | The text to render in the Avatar when format === 'text' | |
glyph | GlyphName | The LeafyGreen icon glyph name to render in the Avatar when format === 'icon' | "Person" |
... | HTMLElementProps<'div'> | Props spread on the root element |
Prop | Type | Description | Default |
---|---|---|---|
darkMode | boolean | Determines if the component will render in dark mode | false |
size | "default" , "large" , "xlarge" | Determines the size of the avatar | "default" |
getInitials
A utility function that returns the initials of the provided string(s).
getInitials(fullOrGivenName?: string, surname?: string): Initials
Accepts one or two strings. If a a single argument is provided, this string will be assumed to be the full name. If two are provided then the 1st is assumed to be the given name, and the 2nd is the surname.
Returns an Initials
object.
interface Initials {
initials: string | null;
givenInitial: string | null;
surnameInitial: string | null;
}
Names including characters other than the English alphabet and common Latin accented letters will be ignored, and will return null
for each property in the returned object. (Includes Letters in Unicode Basic Latin, Latin-1 Supplement and Latin Extended-A. See Wikipedia: List of Unicode characters)
Names with suffixes (e.g. Jr., Sr., etc.) will include the first letter of the suffix in the surname initial (e.g. getInitials("Robert Downey Jr.") // RDJ
)
FAQs
LeafyGreen UI Avatar
The npm package @leafygreen-ui/avatar receives a total of 14,582 weekly downloads. As such, @leafygreen-ui/avatar popularity was classified as popular.
We found that @leafygreen-ui/avatar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.