|
| 1 | +{/* Copyright 2022 Adobe. All rights reserved. |
| 2 | +This file is licensed to you under the Apache License, Version 2.0 (the "License"); |
| 3 | +you may not use this file except in compliance with the License. You may obtain a copy |
| 4 | +of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 5 | +Unless required by applicable law or agreed to in writing, software distributed under |
| 6 | +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS |
| 7 | +OF ANY KIND, either express or implied. See the License for the specific language |
| 8 | +governing permissions and limitations under the License. */} |
| 9 | + |
| 10 | +import {Layout} from '@react-spectrum/docs'; |
| 11 | +export default Layout; |
| 12 | + |
| 13 | +import docs from 'docs:@react-spectrum/avatar'; |
| 14 | +import {HeaderInfo, PropTable, PageDescription} from '@react-spectrum/docs'; |
| 15 | +import packageData from '@react-spectrum/avatar/package.json'; |
| 16 | + |
| 17 | +```jsx import |
| 18 | +import {Avatar} from '@react-spectrum/avatar'; |
| 19 | +import {Flex} from '@react-spectrum/layout'; |
| 20 | +``` |
| 21 | + |
| 22 | +--- |
| 23 | +category: Content |
| 24 | +keywords: [avatar] |
| 25 | +after_version: 3.0.0 |
| 26 | +--- |
| 27 | + |
| 28 | +# Avatar |
| 29 | + |
| 30 | +<PageDescription>{docs.exports.Avatar.description}</PageDescription> |
| 31 | + |
| 32 | +<HeaderInfo |
| 33 | + packageData={packageData} |
| 34 | + componentNames={['Avatar']} |
| 35 | + sourceData={[{type: 'Spectrum', url: 'https://spectrum.adobe.com/page/avatar/'}]} /> |
| 36 | + |
| 37 | +## Example |
| 38 | + |
| 39 | +```tsx example |
| 40 | +<Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" /> |
| 41 | +``` |
| 42 | + |
| 43 | +## Content |
| 44 | + |
| 45 | +The Avatar component is a thumbnail representation of an entity, such as a user or an organization. |
| 46 | + |
| 47 | +**Note: Avatars must have an `alt` attribute.** If the avatar is considered decorative and should not be announced by screen readers, then set `alt=""` to suppress the warning. |
| 48 | + |
| 49 | +### Internationalization |
| 50 | + |
| 51 | +To internationalize an Avatar, a localized string should be passed to the `alt` prop. |
| 52 | + |
| 53 | +## Props |
| 54 | + |
| 55 | +<PropTable component={docs.exports.Avatar} links={docs.links} /> |
| 56 | + |
| 57 | +## Visual options |
| 58 | + |
| 59 | +### Disabled |
| 60 | +[View guidelines](https://spectrum.adobe.com/page/avatar/#Disabled) |
| 61 | +```tsx example |
| 62 | +<Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" isDisabled /> |
| 63 | +``` |
| 64 | + |
| 65 | +### Size |
| 66 | +[View guidelines](https://spectrum.adobe.com/page/avatar/#Size) |
| 67 | +```tsx example |
| 68 | +<Flex gap="size-100" wrap> |
| 69 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-50" /> |
| 70 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-75" /> |
| 71 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-100" /> |
| 72 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-200" /> |
| 73 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-300" /> |
| 74 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-400" /> |
| 75 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-500" /> |
| 76 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-600" /> |
| 77 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size="avatar-size-700" /> |
| 78 | + <Avatar src="https://i.imgur.com/kJOwAdv.png" alt="default Adobe avatar" size={100} /> |
| 79 | +</Flex> |
| 80 | +``` |
0 commit comments