
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
@_nu/react-avatar
Advanced tools
| npm package | npm downloads | jsdelivr | github |
|---|---|---|---|
$ npm install @_nu/react-avatar
/* @/components/Avatar/index.js */
import React from 'react';
import { Container, Img, Skeleton } from '@_nu/react-avatar';
import 'sacss';
import './index.css';
const Avatar = ({
className = '',
src,
size,
placeholder,
children = null,
}) => {
return (
<Container size={size} className={className}>
<Skeleton />
<Img src={src} size={size} placeholder={placeholder} />
{children}
</Container>
);
};
export default Avatar;
import React from 'react';
import Avatar from "./components/Avatar";
import imgAvatar from '../avatar.jpg';
const AvatarDefault = ({ className = null }) => (
<svg
viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg"
className={className}
>
<path d="M512 64a448 448 0 1 0 448 448A448 448 0 0 0 512 64zm0 160a144 144 0 1 1-144 144 143.68 143.68 0 0 1 144-144zm256 573.44a381.76 381.76 0 0 1-512 0v-18.56A166.4 166.4 0 0 1 416 608h192a166.72 166.72 0 0 1 160 169.92v19.52z" />
</svg>
);
const Page=()=>{
return (
<div>
<Avatar alt="hello" size={24} src={imgAvatar} />
<Avatar alt="hello" size={32} src={imgAvatar} />
<Avatar alt="hello" size={40} src={imgAvatar} />
<Avatar alt="hello" size={40} src="123" placeholder={AvatarDefault} />
<Avatar alt="hello" src={imgAvatar} />
<Avatar alt="hello" placeholder={AvatarDefault} />
</div>
);
};
export default Page;
| 属性 | 类型 | 默认值 | 作用 |
|---|---|---|---|
| Component | node | i | 容器组件 |
| children | node | - | 子元素 |
| className | string | - | class |
| src | string | - | 图片地址 |
| alt | string.isRequired | - | 图片描述 |
| size | string | number | '40' | Avatar 尺寸 |
| placeholder | node | string | - | 图片加载失败 |
size={null} 表示头像会撑满整个容器string 表示图片加载失败用这个作为占位图,FAQs
react avatar
We found that @_nu/react-avatar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.