Skip to content
Prev Previous commit
Next Next commit
chore: fixing incorrect updates
  • Loading branch information
georgewrmarshall committed Jul 21, 2025
commit c272bc3ddf2a123fd368324c40de0a32ac27e8c8
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,44 @@ Avatar reserved for representing websites and dapps.
```tsx
import { AvatarFavicon } from '@metamask/design-system-react-native';

<AvatarFavicon imageSource={{ uri: 'https://example.com/favicon.ico' }} />;
<AvatarFavicon src={{ uri: 'https://example.com/favicon.ico' }} />;
```

## Props

### `imageSource`
### `src`

The image source for the favicon.
Optional prop for the source of the image or SVG.

| TYPE | REQUIRED | DEFAULT |
| --------------------- | -------- | ----------- |
| `ImageSourcePropType` | Yes | `undefined` |
| TYPE | REQUIRED | DEFAULT |
| --------------- | -------- | ----------- |
| `ImageOrSvgSrc` | No | `undefined` |

```tsx
<AvatarFavicon imageSource={{ uri: 'https://example.com/favicon.ico' }} />
// Remote image
<AvatarFavicon src={{ uri: 'https://example.com/favicon.ico' }} />

// Local image
<AvatarFavicon src={require('./favicon.png')} />

// Local SVG component
import FaviconSVG from './favicon.svg';
<AvatarFavicon src={FaviconSVG} />
```

### `name`

Optional prop for favicon name, used to calculate fallback text when image fails to load.

| TYPE | REQUIRED | DEFAULT |
| -------- | -------- | ----------- |
| `string` | No | `undefined` |

```tsx
<AvatarFavicon
src={{ uri: 'https://example.com/favicon.ico' }}
name="Example Website"
/>
```

### `size`
Expand All @@ -28,35 +51,53 @@ The size of the AvatarFavicon.

Available sizes:

- `AvatarSize.Xs` (16px)
- `AvatarSize.Sm` (24px)
- `AvatarSize.Md` (32px)
- `AvatarSize.Lg` (40px)
- `AvatarSize.Xl` (48px)
- `AvatarFaviconSize.Xs` (16px)
- `AvatarFaviconSize.Sm` (24px)
- `AvatarFaviconSize.Md` (32px)
- `AvatarFaviconSize.Lg` (40px)
- `AvatarFaviconSize.Xl` (48px)

| TYPE | REQUIRED | DEFAULT |
| ------------ | -------- | --------------- |
| `AvatarSize` | No | `AvatarSize.Md` |
| TYPE | REQUIRED | DEFAULT |
| ------------------- | -------- | ---------------------- |
| `AvatarFaviconSize` | No | `AvatarFaviconSize.Md` |

```tsx
<AvatarFavicon
imageSource={{ uri: 'https://example.com/favicon.ico' }}
size={AvatarSize.Sm}
src={{ uri: 'https://example.com/favicon.ico' }}
size={AvatarFaviconSize.Sm}
/>
```

### `fallbackText`

Text to display when the image fails to load.
Optional text to display when the image fails to load.

| TYPE | REQUIRED | DEFAULT |
| -------- | -------- | ----------- |
| `string` | No | `undefined` |

```tsx
<AvatarFavicon
imageSource={{ uri: 'https://example.com/favicon.ico' }}
fallbackText="FB"
src={{ uri: 'https://example.com/favicon.ico' }}
fallbackText="EX"
/>
```

### `imageOrSvgProps`

Optional props to pass to the underlying ImageOrSvg component.

| TYPE | REQUIRED | DEFAULT |
| -------------------------- | -------- | ----------- |
| `Partial<ImageOrSvgProps>` | No | `undefined` |

```tsx
<AvatarFavicon
src={{ uri: 'https://example.com/favicon.ico' }}
imageOrSvgProps={{
onImageLoad: () => console.log('Image loaded'),
onImageError: () => console.log('Image failed to load'),
}}
/>
```

Expand All @@ -76,19 +117,15 @@ import { AvatarFavicon } from '@metamask/design-system-react-native';

// Add additional styles
<AvatarFavicon
imageSource={{ uri: 'https://example.com/favicon.ico' }}
src={{ uri: 'https://example.com/favicon.ico' }}
twClassName="border-2 border-primary-100"
>
Custom Border
</AvatarFavicon>
/>

// Override default styles
<AvatarFavicon
imageSource={{ uri: 'https://example.com/favicon.ico' }}
src={{ uri: 'https://example.com/favicon.ico' }}
twClassName="!bg-error-100"
>
Override Background
</AvatarFavicon>
/>
```

### `style`
Expand All @@ -109,7 +146,7 @@ const styles = StyleSheet.create({

export const StyleExample = () => (
<AvatarFavicon
imageSource={{ uri: 'https://example.com/favicon.ico' }}
src={{ uri: 'https://example.com/favicon.ico' }}
style={styles.custom}
/>
);
Expand Down
Loading
Loading