logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.5.0
  • Components Overview
  • Changelog
    v6.5.0
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
Examples
Basic
Type
Autoset Font Size
With Badge
Avatar.Group
Responsive Size
API
Avatar
Avatar.Group
Design Token

Avatar

Used to represent users or things, supporting the display of images, icons, or characters.
Importimport { Avatar } from 'antd';
GitHub
components/avatarIssueOpen issues
Docs
Edit this pageLLMs.md
UploadBadge

Resources

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
For Agents
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

Examples

API

Common props ref:Common props

Avatar

PropertyDescriptionTypeDefaultVersionGlobal Config
altThis attribute defines the alternative text describing the imagestring-×
gapLetter type unit distance between left and right sidesnumber44.3.0×
iconCustom icon type for an icon avatarReactNode-×
shapeThe shape of avatarcircle | squarecircle×
sizeThe size of the avatarnumber | large | medium | small | { xs: number, sm: number, ...}medium4.7.0×
srcThe address of the image for an image avatar or image elementstring | ReactNode-ReactNode: 4.8.0×
srcSetA list of sources to use for different screen resolutionsstring-×
draggableWhether the picture is allowed to be draggedboolean | 'true' | 'false'true×
crossOriginCORS settings attributes'anonymous' | 'use-credentials' | ''-4.17.0×
onErrorHandler when img load error, return false to prevent default fallback behavior() => boolean-×

Tip: You can set icon or children as the fallback for image load error, with the priority of icon > children

Avatar.Group 4.5.0+

PropertyDescriptionTypeDefaultVersion
maxSet maximum display related configurations{ count?: number; style?: CSSProperties; popover?: PopoverProps }-5.18.0
maxCountDeprecated, please use max={{ count: number }}number-
maxPopoverPlacementDeprecated, please use max={{ popover: PopoverProps }}top | bottomtop
maxPopoverTriggerDeprecated, please use max={{ popover: PopoverProps }}hover | focus | clickhover
maxStyleDeprecated, please use max={{ style: CSSProperties }}CSSProperties-
sizeThe size of the avatarnumber | large | medium | small | { xs: number, sm: number, ...}medium4.8.0
shapeThe shape of the avatarcircle | squarecircle5.8.0

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
containerSizeSize of Avatarnumber32
containerSizeLGSize of large Avatarnumber40
containerSizeSMSize of small Avatarnumber24
groupBorderColorBorder color of avatars in a groupstring#ffffff
groupOverlappingOverlapping of avatars in a groupnumber-8
groupSpaceSpacing between avatars in a groupnumber4
iconFontSizeFont size of Avatar iconnumber18
iconFontSizeLGFont size of large Avatar iconstring | number24
iconFontSizeSMFont size of small Avatar iconnumber14
textFontSizeFont size of Avatarnumber14
textFontSizeLGFont size of large Avatarnumber14
textFontSizeSMFont size of small Avatarnumber14
Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
colorTextLightSolidControl the highlight color of text with background color, such as the text in Primary Button components.string#fff
colorTextPlaceholderControl the color of placeholder text.stringrgba(0,0,0,0.25)
borderRadiusBorder radius of base componentsnumber6
borderRadiusLGLG size border radius, used in some large border radius components, such as Card, Modal and other components.number8
borderRadiusSMSM size border radius, used in small size components, such as Button, Input, Select and other input components in small sizenumber4
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
lineHeightLine height of text.number1.5714285714285714
lineTypeBorder style of base componentsstringsolid
lineWidthBorder width of base componentsnumber1
Basic

Three sizes and two shapes are available.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Autoset Font Size

For letter type Avatar, when the letters are too long to display, the font size can be automatically adjusted according to the width of the Avatar. You can also use gap to set the unit distance between left and right sides.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Avatar.Group

Avatar group display.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Type

Image, Icon and letter are supported, and the latter two kinds of avatar can have custom colors and background colors.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
With Badge

Usually used for reminders and notifications.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Responsive Size

Avatar size can be automatically adjusted based on the screen size.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
U
K
K+2
K+2
K+2
AK
U
USER
avatar
U
1