logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
5.25.4
  • Components Overview
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • 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
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
      5.13.0
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";
Sourcecomponents/avatar
Docs
Edit this pageChangelog
contributors
  • 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
    Twitter
    yuque logoAnt Design in YuQue
    Ant Design in Zhihu
    Experience Cloud Blog
    seeconf logoSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    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
    xtech logoAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Ant Design Community

    Examples

    API

    Common props ref:Common props

    Avatar

    PropertyDescriptionTypeDefaultVersion
    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 | small | default | { xs: number, sm: number, ...}default4.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, Before 5.18.0 you can use parameters{ count?: number; style?: CSSProperties; popover?: PopoverProps }-5.18.0
    sizeThe size of the avatarnumber | large | small | default | { xs: number, sm: number, ...}default4.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
    textFontSizeFont size of Avatarnumber18
    textFontSizeLGFont size of large Avatarnumber24
    textFontSizeSMFont size of small Avatarnumber14
    Global TokenHow to use?
    Basic

    Three sizes and two shapes are available.

    CodeSandbox Icon
    codeblock
    codepen icon
    External Link Icon
    expand codeexpand code
    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
    codeblock
    codepen icon
    External Link Icon
    expand codeexpand code
    Avatar.Group

    Avatar group display.

    CodeSandbox Icon
    codeblock
    codepen icon
    External Link Icon
    expand codeexpand code
    Type

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

    CodeSandbox Icon
    codeblock
    codepen icon
    External Link Icon
    expand codeexpand code
    With Badge

    Usually used for reminders and notifications.

    CodeSandbox Icon
    codeblock
    codepen icon
    External Link Icon
    expand codeexpand code
    Responsive Size

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

    CodeSandbox Icon
    codeblock
    codepen icon
    External Link Icon
    expand codeexpand code
    U
    K
    K+2
    K+2
    K+2
    AK
    U
    USER
    avatar
    U
    1