mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
Both old names are owned by a different npm account (artemis-prime), so publishing them returns 403 — which is how this surfaced: the 8.0.0 run shipped @hanzogui/logo and @hanzogui/demos depending on [email protected], a version that cannot be published and therefore does not exist. Those two were uninstallable. @hanzo/gui and @hanzogui/* are ours, so the framework now carries the name it is imported by everywhere downstream, and the loader moves under the scope we control. The rewrite is limited to package references. `DEBUG?.startsWith('hanzogui')` is a log-namespace filter and join(dir, 'hanzogui') is a path — rewriting either would change behaviour, so both are untouched. Co-authored-by: Hanzo Dev <[email protected]>
71 lines
1.3 KiB
Plaintext
71 lines
1.3 KiB
Plaintext
---
|
|
title: Avatar
|
|
description: Display aspect-ratio-fixed images with a fallback while loading
|
|
name: avatar
|
|
component: Avatar
|
|
package: avatar
|
|
demoName: Avatar
|
|
---
|
|
|
|
<HeroContainer>
|
|
<AvatarDemo />
|
|
</HeroContainer>
|
|
|
|
```tsx hero template=Avatar
|
|
|
|
```
|
|
|
|
<Highlights
|
|
features={[
|
|
'Accepts size prop that stays in sync with other components.',
|
|
'Completely control styles on every element.',
|
|
'Automatically swaps fallback for image on load.',
|
|
]}
|
|
/>
|
|
|
|
## Installation
|
|
|
|
Avatar is already installed in `hanzogui`, or you can install it independently:
|
|
|
|
```bash
|
|
npm install @hanzogui/avatar
|
|
```
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
import { Avatar } from '@hanzo/gui'
|
|
|
|
export default () => (
|
|
<Avatar circular size="$6">
|
|
<Avatar.Image src="http://picsum.photos/200/300" />
|
|
<Avatar.Fallback bc="red" />
|
|
</Avatar>
|
|
)
|
|
```
|
|
|
|
## API Reference
|
|
|
|
### Avatar
|
|
|
|
Avatar extends [Square](/docs/components/shapes#shape-props), giving it all the [Gui standard props](/docs/intro/props) as well as `size` and `circular`.
|
|
|
|
### Avatar.Fallback
|
|
|
|
Avatar.Fallback extends [YStack](/docs/components/stacks), plus:
|
|
|
|
<PropsTable
|
|
data={[
|
|
{
|
|
name: 'delayMs',
|
|
required: false,
|
|
type: 'number',
|
|
description: `Milliseconds to wait before showing the fallback, to prevent flicker.`,
|
|
},
|
|
]}
|
|
/>
|
|
|
|
### Avatar.Image
|
|
|
|
Avatar.Image extends [Image](/docs/components/image).
|