सीधे मुख्य कॉन्टेंट पर जाएँ
menumenu tanreiexpand_morecontrasttranslate
tanreiexpand_more
शुरुआत करेंWebReactSwiftUIJetpack ComposeFlutterReact Nativeप्रीसेटआपका अपना डिज़ाइन सिस्टमAI एजेंट के साथ Tanrei का इस्तेमालब्रांडडिज़ाइन टोकनडिज़ाइन सिस्टम और कस्टमाइज़ेशनTheme Studioरंगटाइपोग्राफ़ीआइकनशेपएलिवेशनमोशनइंटरैक्शन स्टेटव्यवहारलेआउटसुलभताशब्दकलर टोकनटाइप स्केल टोकनशेप टोकनएलिवेशन टोकनमोशन टोकनस्टेट टोकनस्पेस और माप के टोकनकंपोनेंटबटनमुख्य ऐक्शन बटनसेगमेंटेड बटनबटन ग्रुपमेन्यू वाला बटनटूलबारकॉपी बटनचेकबॉक्सरेडियो बटनस्विचचिपमेन्यूस्लाइडरस्लाइडर फ़ील्डकैलेंडरDateTimePickerफ़ील्ड ग्रुपरेडियो ग्रुपचेकबॉक्स ग्रुपसिलेक्टसिलेक्ट फ़ील्डमेन्यू बारफ़ाइल अपलोडफ़ाइल पिकर उन्नतड्रॉप ज़ोनटेक्स्ट इनपुट उन्नतटेक्स्ट फ़ील्डचिप फ़ील्डफ़ील्डकॉम्बोबॉक्स उन्नतकॉम्बोबॉक्स फ़ील्डनंबर इनपुट उन्नतनंबर फ़ील्डकलर इनपुट उन्नतकलर फ़ील्डवन-टाइम कोड इनपुट उन्नतवन-टाइम कोड फ़ील्डएम्बेडेड टेक्स्ट इनपुट उन्नतचैट कंपोज़रकार्डडिवाइडरमोडल लेयर उन्नतडायलॉगलिस्टलिस्ट पंक्तिबॉटम शीटसाइड शीटकैरसेलकोड ब्लॉकटेबलपॉपओवरचरणअकॉर्डियनडिस्क्रिप्शन लिस्टफ़िगरऐप शेलपेज हेडरट्री व्यूटाइमलाइनइमेज प्रीव्यूसाइज़ हैंडलसाइज़ बदलने वाला फ़्रेमस्क्रॉल एरियाबैजप्रोग्रेस इंडिकेटरमीटरनंबर टिकरलोडिंग इंडिकेटरस्नैकबारटूलटिपकीबोर्ड शॉर्टकटटैगइनलाइन कोडकॉलआउटअवतारख़ाली स्टेटटैग ग्रुपस्केलेटनफ़ाइल आइटमस्वॉचमार्की टेक्स्टटैबटैब व्यूऐप बारनेविगेशन बारनेविगेशन ड्रॉअरखोजलिंकपेजिनेशनपिछला और अगला लिंकस्टेपरब्रेडक्रंबविषय सूचीलिंक कार्डFAB मेन्यूस्थितिTanrei कैसे बनता हैयोगदानलाइसेंस और श्रेय
होमकंपोनेंटअवतार

अवतार

किसी व्यक्ति, टीम या प्रोजेक्ट को एक छोटी तस्वीर से दिखाता है, और जहाँ तस्वीर नहीं है वहाँ नाम के पहले अक्षरों या ग्लिफ़ से, तीन साइज़ के गोले या गोल कोनों वाले चौकोर में। कई अवतार एक-दूसरे पर चढ़े हुए एक ग्रुप के रूप में दिखाए जाते हैं, जो बाक़ी की गिनती बताता है। यह तस्वीर है, कंट्रोल कभी नहीं।

content_copyMarkdown में देखें
श्रेणी
कम्युनिकेशन
टोकन
comp.avatar
स्तर
आधार

अवलोकन

Web
tanrei-avatar
schedule
SwiftUI
TanreiAvatar
radio_button_unchecked
Jetpack Compose
TanreiAvatar
radio_button_unchecked
Flutter
TanreiAvatar
radio_button_unchecked
React Native
Avatar
radio_button_unchecked

इससे जनरेट किया गया: docs/status/status.json, specs/avatar.spec.json

नाम के पहले अक्षर, एक ग्लिफ़, एक चौकोर, और एक ग्रुप

अवतार बताता है कि कोई चीज़ किसकी है: पोस्ट का लेखक, बातचीत में शामिल लोग, किसी काम का ज़िम्मेदार। वह एक तस्वीर बनाता है, और जब तस्वीर नहीं होती, तब भी उसके पास बनाने के लिए हमेशा कुछ होता है। वह पॉइंटर, कुंजी या फ़ोकस का कभी जवाब नहीं देता।

वेब पर यह <tanrei-avatar> है, और कई अवतार साथ हों तो <tanrei-avatar-group>। बाक़ी प्लैटफ़ॉर्म ने इसे अभी इम्प्लीमेंट नहीं किया है।

इस्तेमाल

<!-- अकेला: नाम उसके लेबल से आता है। -->
<tanrei-avatar label="अदिति शर्मा" initials="अश" src="/people/aditi.jpg"></tanrei-avatar>

<!-- टेक्स्ट में लिखे उसी नाम के बग़ल में: सजावटी, ताकि नाम एक ही बार पढ़ा जाए। -->
<p>
  <tanrei-avatar decorative size="small" initials="अश" src="/people/aditi.jpg"></tanrei-avatar>
  अदिति शर्मा
</p>

<!-- कोई एक व्यक्ति नहीं: चौकोर, आपके अपने ग्लिफ़ के साथ। -->
<tanrei-avatar label="बिल्ड सर्विस" shape="square"><span slot="icon">smart_toy</span></tanrei-avatar>

<!-- छह सदस्य, ज़्यादा से ज़्यादा चार बॉक्स: तीन सदस्य और "+3"। -->
<tanrei-avatar-group label="रिव्यूअर" max="4" overflow-label="और {count} लोग">
  <tanrei-avatar label="अदिति शर्मा" initials="अश"></tanrei-avatar>
  <tanrei-avatar label="रोहन वर्मा" initials="रोव"></tanrei-avatar>
  <!-- … -->
</tanrei-avatar-group>

<!-- स्क्रिप्ट के आने से पहले यह स्टाइलशीट हर अवतार की जगह बनाए रखती है। -->
<link rel="stylesheet" href="@tanrei/web/avatar.css" />
<script type="module">
  import '@tanrei/web/components/avatar';
</script>
import { Avatar, AvatarGroup } from '@tanrei/react';

<Avatar label={person.name} initials={person.initials} src={person.picture} />

<AvatarGroup label="रिव्यूअर" max={4} total={reviewerCount} overflowLabel="और {count} लोग">
  {reviewers.slice(0, 3).map((person) => (
    <Avatar key={person.id} label={person.name} initials={person.initials} src={person.picture} />
  ))}
</AvatarGroup>

स्पेक

तीन साइज़, दो शेप

संरचना

भाग विवरण
1 container The square box of the avatar's size, clipped to a circle or to a rounded square, with a quiet fill that shows behind the initials, the glyph, a picture that is still loading and the transparent parts of a picture. It carries no state: nothing about it answers a pointer, a press or focus.
2 image · वैकल्पिक The picture the product names by its address, filling the box and clipped to its shape. Drawn once it has loaded.
3 label · वैकल्पिक The initials the product gives, drawn at the centre of the box where there is no picture to show. A picture of a name, not text to be read: the name is the avatar's label.
4 icon · वैकल्पिक The fallback glyph, at the centre of the box, where there is neither a picture nor initials: the glyph the product names, or the system's own (a person for a circle, a neutral mark for a square).
5 group · वैकल्पिक Several avatars drawn as one row in which each lies a little over the one before it, with a gap around each so that two pictures are read as two. The group gives its avatars their size and shape.
6 overflow · वैकल्पिक The last box of a group that does not draw all its members: an avatar-sized box in the fallback's colors holding a plus sign and the number of members not drawn.

प्रॉपर्टी

प्रॉपर्टी टाइप डिफ़ॉल्ट विवरण
src string "" The address of the picture. Empty, or a picture that has not loaded or cannot be loaded, draws the fallback: initials where the product gave some, otherwise a glyph.
label string "" The name of the person or the thing the avatar stands for, in full ("Ada Lovelace", "Design team"). Not drawn: it is the avatar's accessible name while decorative is false. In the group form it is the group's name ("Reviewers").
initials string "" The one or two characters drawn where there is no picture ("AL", "山"). The product makes them: which characters stand for a name depends on its writing system and its order, which the avatar cannot know. Never read by assistive technology.
decorative boolean false True hides the avatar from assistive technology, for an avatar that stands beside the same name in visible text (a byline, a list row, a comment's header), so the name is read once. False, for an avatar that stands alone, exposes it as an image named by label. Ignored for the members of a group.
size small | medium | large "medium" Small (24) stands beside one line of text: a byline, a table cell, a mention. Medium (40) is a list row's or a comment's avatar. Large (56) heads a person's own page or card. A group gives its size to every member. A design system may add values.
shape circle | square "circle" Circle is a person. Square, a rounded square, is something that is not one person: a team, a project, an organisation, a bot. A group gives its shape to every member. A design system may add values.
max number 0 Group form only. The most boxes the group draws, the overflow box included; 0 draws every member. A whole number of 2 or more: with more members than this, the group draws one fewer member than max and then the overflow box.
total number null Group form only. How many members there are, where the product gives the group fewer than exist (the first five of a team of two hundred). Null counts the members given.
overflowLabel string "" Group form only. What assistive technology reads for the overflow box: the whole sentence in the product's language, with one place, {count}, which the group fills with the number of members not drawn ("{count} more", "ほか{count}人"). Written once as the product's words, it serves every group. A sentence that is right for every number, or a prop set per count where the language needs another form for one. Empty reads the product's words; with neither, the drawn text ("+12").

स्लॉट

स्लॉट विवरण
icon The fallback glyph: a glyph of the system's icon set, by name, drawn through the platform's icon helper where there is neither a picture nor initials. Empty draws the system's own fallback glyph.

आइटम

वे आइटम के प्रकार जिन्हें कंपोनेंट दोहराता है। फ़िक्स्चर अपने आइटम क्रम से सूचीबद्ध करता है; हर प्लैटफ़ॉर्म हर प्रकार को अपने तरीक़े से नाम देता है।

member

One avatar of a group: an avatar with its own picture, name, initials and glyph, drawn at the group's size and shape.

प्रॉपर्टी टाइप डिफ़ॉल्ट विवरण
src string "" The address of the member's picture.
label string "" The member's name. Always exposed in a group: the names are what the group says.
initials string "" The member's initials, drawn where there is no picture.
स्पेक Web SwiftUI Jetpack Compose Flutter React Native
आइटम tanrei-avatar TanreiAvatar TanreiAvatar TanreiAvatar Avatar
src · प्रॉपर्टी src url model image source
label · प्रॉपर्टी label name name name name
initials · प्रॉपर्टी initials initials initials initials initials
टिप्पणियाँ A <tanrei-avatar> child of <tanrei-avatar-group>, with all of an avatar's own attributes and its icon slot. The group sets the member's size and shape and makes it named. A TanreiAvatar in the group's builder. A TanreiAvatar call in the group's content. A TanreiAvatar in the group's children. An <Avatar> child of <AvatarGroup>.

स्टेट

व्यवहार

EARS रूप में लिखी गई आवश्यकताएँ। हर प्लैटफ़ॉर्म के इम्प्लीमेंटेशन को इन ID के आधार पर टेस्ट किया जाता है। आवश्यकताओं का पाठ स्पेक फ़ाइल से ज्यों का त्यों, अंग्रेज़ी में दिखाया गया है।

ID आवश्यकता
AVT-1 THE avatar SHALL draw a square box whose side is the container size of its size (comp.avatar.container.size.small for small, comp.avatar.container.size.medium for medium, comp.avatar.container.size.large for large), with the corners of its shape (comp.avatar.container.shape.circle for circle, comp.avatar.container.shape.square for square), never larger than half the box's side (a circle where the value is sys.shape.corner.full) and eased by sys.shape.corner-smoothing, filled with comp.avatar.container.color, and SHALL clip everything it draws to that shape. THE avatar SHALL lay itself out inline with the text or the row it is placed in, as one unbreakable box that the layout neither stretches nor shrinks, and SHALL draw no edge and no elevation.
AVT-2 THE avatar SHALL draw exactly one of three things at the centre of its box (and two only for the cross-fade in which its picture arrives, AVT-4), the first of these that it has: the picture src names, once that picture has loaded (AVT-3, AVT-4); else initials, where initials is not empty (AVT-5); else a glyph (AVT-6). THE avatar SHALL never draw an empty box, a broken-picture mark or the picture's address, and SHALL NOT make initials out of label.
AVT-3 WHILE the picture of src has loaded THE avatar SHALL draw it over the whole box, scaled so that it covers the box with its proportions kept and its centre on the box's centre, clipped to the box's shape, over comp.avatar.container.color (which shows through the picture's transparent parts), and SHALL draw neither initials nor a glyph. THE avatar SHALL NOT mirror, tint or otherwise change the picture in any layout direction or scheme.
AVT-4 WHILE src is not empty and its picture has not yet loaded THE avatar SHALL draw its fallback (AVT-2) in the box, at the avatar's full size, so that nothing changes place when the picture arrives; WHEN the picture has loaded THE avatar SHALL fade it in over the fallback while the fallback fades out beneath it, one cross-fade of opacity over comp.avatar.motion.picture-duration on comp.avatar.motion.picture-easing (sys.motion.role.state.default and sys.motion.easing.state), in which nothing changes place or size; reduced motion keeps it, as a change of opacity is not motion (MOT-6). WHERE the picture loads while the avatar draws its first frames (MOT-3), or the platform already holds it when the avatar asks for it (in its memory of the pictures it has loaded), THE avatar SHALL draw it at once, in the fallback's place. IF the picture cannot be loaded THE avatar SHALL keep the fallback, SHALL NOT ask for the picture again by itself, and in debug builds SHALL report the address that failed. WHEN src changes THE avatar SHALL draw the fallback at once, until the new picture has loaded and fades in. WHILE src is empty THE avatar SHALL ask for nothing.
AVT-5 WHERE the avatar draws initials THE avatar SHALL set them on one line at the centre of the box, in the text style of its size (comp.avatar.label.typescale.small for small, comp.avatar.label.typescale.medium for medium, comp.avatar.label.typescale.large for large) and in comp.avatar.label.color, as the product wrote them: it SHALL NOT change their case, and SHALL draw no more than the first two characters as a reader counts them (grapheme clusters), reporting in debug builds a value that is longer. THE avatar SHALL lay the initials out as text of their own direction, isolated from the text around the avatar, and SHALL keep them from assistive technology.
AVT-6 WHERE the avatar draws a glyph THE avatar SHALL draw the glyph of its icon slot, or, where the slot is empty, the system's fallback glyph for its shape (person for circle, category for square), in a box of the icon size of its size (comp.avatar.icon.size.small for small, comp.avatar.icon.size.medium for medium, comp.avatar.icon.size.large for large) at the centre of the avatar, in comp.avatar.icon.color, with sys.icon.family.unselected and sys.icon.fill.unselected, sys.icon.weight and an optical size clamped between sys.icon.optical-size.min and sys.icon.optical-size.max, and SHALL keep it from assistive technology.
AVT-7 THE avatar SHALL NOT take pointer, touch or keyboard input, SHALL NOT take focus or be a stop in the focus order, and SHALL NOT change anything it draws under a pointer, a press or focus: it has no hovered, focused, pressed, selected or disabled state, draws no state layer, no ripple and no focus indicator, and emits no event.
AVT-8 WHERE the avatar is placed inside an element that takes input (a link, a Button, a list item, a chip, a card that is pressed as a whole) THE avatar SHALL let input over it reach that element, SHALL stay as it is drawn while that element is hovered, focused or pressed (the state and the focus indicator are drawn by that element, on its own container), and SHALL NOT become a second target inside it; WHILE decorative is false THE avatar SHALL add its label to that element's content in reading order, so that a link or a Button that holds an avatar and nothing else is named by the avatar's label. An avatar that leads somewhere or opens something is that composition: the avatar has no destination and no action of its own.
AVT-9 WHILE decorative is false and label is not empty THE avatar SHALL be exposed to assistive technology as one image named by label, whether it draws a picture, initials or a glyph, and SHALL expose nothing else: not the initials, not the glyph's name, not the picture's address, and not its size or shape. WHILE decorative is true THE avatar SHALL expose nothing. IF decorative is false, label is empty and the product gives it no name (AVT-24) THE avatar SHALL expose nothing and in debug builds report that an avatar has no name.
AVT-10 WHEN label, initials, the icon slot's glyph, size or shape changes THE avatar SHALL draw and expose the new value at once, without a motion, and SHALL NOT announce the change by itself.
AVT-11 WHILE the text size is enlarged THE avatar SHALL keep its box at the container size of its size and its glyph at the size of AVT-6, and SHALL let its initials, and a group's count (AVT-17), follow their text style as it grows, no larger than the glyph's box of the same size (comp.avatar.icon.size.small for small, comp.avatar.icon.size.medium for medium, comp.avatar.icon.size.large for large), so that they still stand whole inside the box: an avatar is a picture and is enlarged with the page, not with the text, as a glyph's box is, while the letters it holds grow as far as the box leaves room for them.
AVT-12 WHERE the avatar is the anchor of a badge THE avatar SHALL be drawn exactly as it is without one: its square box is the anchor's bounds, the badge is placed by that box's top-end corner and drawn outside the avatar's clip (BDG-1, BDG-3, BDG-7), and the badge's label is added to the avatar's description after its name (BDG-8). THE avatar SHALL have no dot, count or status of its own.
AVT-13 WHERE the platform draws with a person's own forced colors (the web's forced-colors mode, and a platform's equivalent where it has one) THE avatar SHALL draw an edge sys.border.hairline wide in the platform's text color inside its box, following its shape, and its initials or its glyph in that text color, so that a fallback whose fill the mode removes is still a bounded mark; THE avatar SHALL leave a picture's own colors as they are.
AVT-14 THE avatar SHALL take its layout direction from where it is used — the direction of the nearest ancestor that sets one, and the platform's own where none does — and SHALL have no direction setting of its own; WHEN that direction changes while the avatar is shown THE avatar SHALL draw itself for the new direction at once, without a motion of its own, keeping what it shows. A single avatar is the same in both directions but for its glyph (AVT-15): its picture is never mirrored and its initials keep their own order (AVT-5).
AVT-15 WHERE the layout direction is right-to-left THE avatar SHALL draw the glyph of its icon slot mirrored left to right exactly when the system's icon set marks that glyph's name as mirrored or the product forces mirroring for that use, and unmirrored when the product forbids it: the icon helper mirrors the glyph inside its own box, about the box's vertical centre line, changing neither its place nor its size, color and fill. THE avatar SHALL NOT mirror a glyph itself, and SHALL NOT mirror its picture or its initials.
AVT-16 WHERE the avatar is given members THE avatar SHALL be a group: it SHALL draw its members in one row that does not wrap, in the order they are given from the start edge, each as an avatar of the group's size and shape with that member's own picture, initials or glyph (AVT-2 to AVT-6), and SHALL ignore its own src, initials, icon slot and decorative. Each box after the first SHALL lie over the end of the one before it by the overlap of the group's size (comp.avatar.group.overlap.small for small, comp.avatar.group.overlap.medium for medium, comp.avatar.group.overlap.large for large) and be drawn above it, and every box SHALL be surrounded, outside its own edge and following its shape, by a gap comp.avatar.group.outline.width wide in comp.avatar.group.outline.color that takes no room in the layout. THE group SHALL be as wide as its boxes less their overlaps, and as high as one box.
AVT-17 WHILE the group has more members than max and max is 2 or more THE group SHALL draw the first max less one members and then, as its last box, an overflow box: a box of the group's size and shape filled with comp.avatar.container.color, placed and surrounded as a member is (AVT-16), holding on one line, in the label style of the group's size (AVT-5) and comp.avatar.label.color, a plus sign followed by the number of members not drawn. WHILE max is 0, or the group has no more members than max, THE group SHALL draw every member and no overflow box, unless total says more exist (AVT-18). THE overflow box SHALL take no input and SHALL NOT be a control: showing the members it counts is the product's, beside the group.
AVT-18 WHILE total is greater than the number of members the group is given THE group SHALL count as not drawn every member up to total, and SHALL draw the overflow box with that number after the members it draws: where the members given fit within max less one, or max is 0, all of them are drawn before it. THE group SHALL write the number in the current locale's digits with no grouping separator, SHALL draw 99 followed by a plus sign in place of a number above 99, at every size, so that the box never holds more than three characters (the exact number stays in overflowLabel, AVT-19), and SHALL lay the sign and the number out as one left-to-right run isolated from the text around it, so that the plus sign stays before the digits in a right-to-left layout.
AVT-19 THE group SHALL be exposed to assistive technology as one group named by its label, holding in order one image for each member it draws, each named by that member's label whatever decorative says, and then, where it draws an overflow box, one text: overflowLabel — from the instance's prop or, WHILE that is empty, from the product's words of the key avatarGroupOverflowLabel — with its place {count} filled by the number of members not drawn, in the current locale's digits with no grouping separator and never cut at 99 as the drawn text is (AVT-18); else the drawn text. Another text between braces, and a brace that opens or closes nothing, SHALL be read as written and reported in debug builds; a sentence without {count} SHALL be read as written and reported in debug builds, because it does not say how many. THE gaps SHALL be kept from assistive technology. IF the group's label is empty THE group SHALL expose its members without a group's name and in debug builds report that a group has no name; IF a member's label is empty THE group SHALL expose nothing for that member and in debug builds report it.
AVT-20 WHERE the layout direction is right-to-left THE group SHALL lay its row out from the right: the first member is at the right, each following box lies over the left end of the one before it and above it, and the overflow box is the leftmost; the order assistive technology reads SHALL stay the order given.
AVT-21 WHEN the group's members, max, total, size or shape change THE group SHALL draw and expose the new row at once, without a motion, and SHALL NOT announce the change by itself.
AVT-22 WHEN size or shape names a value that the active design system does not have THE avatar SHALL render with the default value's tokens, and in debug builds report the unknown value. IF max is 1, negative or not a whole number THE group SHALL draw as for 0 and in debug builds report it; IF total is not null and is less than the number of members given, negative or not a whole number THE group SHALL count the members given and in debug builds report it.
AVT-23 IF the avatar is a group and every member has been removed THE group SHALL draw nothing, take no space and expose nothing. IF max, total or overflowLabel is set on an avatar that has no members THE avatar SHALL ignore it and in debug builds report it.
AVT-24 WHERE the platform has ARIA attributes (the web), an avatar's host and a group's host carries its role (AVT-9, AVT-19) itself, so what the product writes on it is not moved, but for a name: WHILE label is not empty THE avatar SHALL hold the product's aria-label and aria-labelledby on that host as their data-aria- twins, so that label is its whole name although the platform gives aria-labelledby the precedence, and WHEN label is emptied SHALL give them back as they were written; WHILE label is empty a name the product gives so — aria-label, or aria-labelledby naming an element — SHALL be its name and SHALL NOT be reported as having none in debug builds (AVT-9, AVT-19). WHILE an avatar's label is empty and decorative is false (or it is a member of a group) a name the product gives so SHALL make it one image named by that name, as AVT-9 says of its label: an image the product names is a named image. WHILE an avatar is decorative and not a member, or a group has no members (AVT-23), it exposes nothing, and THE avatar SHALL hold them as well, giving them back when it is exposed again. WHEN the product removes one, or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaLabelledByElements) to null, THE avatar SHALL take it away.

प्लैटफ़ॉर्म के अनुसार नामों का मिलान

पैरिटी का मतलब एक जैसे API नहीं है। हर प्लैटफ़ॉर्म एक ही कॉन्ट्रैक्ट को अपने तरीक़े से व्यक्त करता है।

स्पेक Web SwiftUI Jetpack Compose Flutter React Native
कंपोनेंट tanrei-avatar TanreiAvatar TanreiAvatar TanreiAvatar Avatar
src · प्रॉपर्टी src url model image source
label · प्रॉपर्टी label name name name name
initials · प्रॉपर्टी initials initials initials initials initials
decorative · प्रॉपर्टी decorative isDecorative decorative decorative decorative
size · प्रॉपर्टी size size size size size
shape · प्रॉपर्टी shape shape shape shape shape
max · प्रॉपर्टी max max max max max
total · प्रॉपर्टी total total total total total
overflowLabel · प्रॉपर्टी overflowLabel overflowLabel overflowDescription overflowSemanticLabel overflowAccessibilityLabel
टिप्पणियाँ Two elements: <tanrei-avatar src label initials size shape decorative> with the fallback glyph in its icon slot, and the group form as <tanrei-avatar-group label max total overflow-label size shape> whose light-DOM children are the <tanrei-avatar> members (the spec's group props are the group element's attributes; overflowLabel is reflected as overflow-label). The avatar's host is display: inline-block, flex: none, vertical-align: middle, with role="img" and aria-label while it is named and aria-hidden="true" while decorative, set through ElementInternals where axe can see it and as attributes otherwise; no tabindex, no listeners, and pointer-events left as they are, so a press over an avatar inside a link or a Button reaches that element (AVT-8). The picture is an <img alt="" decoding="async"> in the shadow root with object-fit: cover, kept hidden until its load (and its decode), then faded in while the fallback fades out — at once where the picture was complete as soon as its address was set, the browser's list of available images — and removed on error (AVT-4); loading, referrerpolicy and crossorigin are forwarded to it and mean nothing off the web. Initials are one dir="auto" run cut to two grapheme clusters with Intl.Segmenter (AVT-5). **Before the element is defined** the stylesheet of @tanrei/web gives tanrei-avatar:not(:defined) the box of its size and shape attributes in the container color and hides its children, so a page of avatars does not move when the script arrives; no picture, initials or name show until then, which is why a byline writes the name as text beside a decorative avatar. tanrei-avatar-group:not(:defined) is an inline flex row of those boxes. The group is role="group" with aria-label; it sets size, shape and the named state on its members, hides the members past the limit with hidden (they stay in the document), and draws the overflow box in its own shadow root as aria-hidden text beside a visually hidden run that carries overflow-label (AVT-19). The gap of AVT-16 is an outline (or a box-shadow spread) in --tanrei-comp-avatar-group-outline-color, never a border, so it takes no room; later members are above earlier ones by document order, which needs no z-index. Under forced-colors: active the box takes a CanvasText border and the <img> keeps forced-color-adjust: none (AVT-13). A badge on an avatar is <tanrei-badge label="3 unread"><tanrei-avatar …></tanrei-avatar></tanrei-badge>; a link is <tanrei-link href="…"><tanrei-avatar label="Ada Lovelace" …></tanrei-avatar></tanrei-link> or a plain anchor. TanreiAvatar(_ name: String, url: URL?, initials:, icon:, size:, shape:, isDecorative:), the fallback glyph given by name through icon:; the picture through AsyncImage, whose placeholder and failure phases both draw the fallback. The group form is TanreiAvatarGroup(_ name: String, max:, total:, overflowLabel:, size:, shape:) { TanreiAvatar(…) … }, which carries the spec's group props. Not a Button; allowsHitTesting(false) so a press reaches a Link, a Button or a row that holds it. One accessibility element with the image trait and the name as its label, or hidden while decorative; the group is accessibilityElement(children: .contain) with the group's label. TanreiAvatar(name, model, initials, icon, size, shape, decorative), the fallback glyph given by name through icon. The package keeps no image-loading dependency: model is handed to a painter the app provides through a composition local, and a painter that reports loading or failure draws the fallback (the same arrangement the chip's avatar needs; the platform's agent settles it). The group form is TanreiAvatarGroup(name, max, total, overflowDescription, size, shape) { TanreiAvatar(…) … }. No clickable and no focusable modifier; semantics are Role.Image with the name as contentDescription, cleared while decorative; the group is a semantics node with the group's name that contains its members. TanreiAvatar(name: …, image: ImageProvider?, initials:, icon:, size:, shape:, decorative:), the fallback glyph given by name through icon; the picture through Image(image:, frameBuilder:, errorBuilder:), both builders drawing the fallback. The group form is TanreiAvatarGroup(name: …, max:, total:, overflowSemanticLabel:, size:, shape:, children: [TanreiAvatar(…), …]). Wrapped in IgnorePointer, with no Focus. Semantics(image: true, label: name) over the drawn parts, which are excluded, or ExcludeSemantics while decorative; the group is Semantics(container: true, label: name). <Avatar name="Ada Lovelace" source={{ uri }} initials="AL" />; the fallback glyph is the icon prop (a glyph name). The picture is an Image whose onLoad shows it and whose onError keeps the fallback. The group form is <AvatarGroup name="Reviewers" max={4} total={…} overflowAccessibilityLabel="…"> with <Avatar> children. pointerEvents="none" and not focusable. One accessible element with accessibilityRole="image" and the name as accessibilityLabel, or accessible={false} with importantForAccessibility="no-hide-descendants" while decorative. Follows the app's direction where an ancestor's is not known.

टोकन

टोकन किसका एलियास रिज़ॉल्व किया गया मान (लाइट)
--tanrei-comp-avatar-container-color sys.color.surface-container-highest #eeeeee
--tanrei-comp-avatar-container-shape-circle sys.shape.corner.full 9999px
--tanrei-comp-avatar-container-shape-square sys.shape.corner.small 6px
--tanrei-comp-avatar-container-size-large — 56px
--tanrei-comp-avatar-container-size-medium — 40px
--tanrei-comp-avatar-container-size-small — 24px
--tanrei-comp-avatar-group-outline-color sys.color.surface #ffffff
--tanrei-comp-avatar-group-outline-width sys.border.thick 2px
--tanrei-comp-avatar-group-overlap-large sys.space.space100 8px
--tanrei-comp-avatar-group-overlap-medium sys.space.space50 4px
--tanrei-comp-avatar-group-overlap-small sys.space.space25 2px
--tanrei-comp-avatar-icon-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-avatar-icon-size-large sys.icon.large 32px
--tanrei-comp-avatar-icon-size-medium sys.icon.medium 24px
--tanrei-comp-avatar-icon-size-small sys.icon.extra-small 16px
--tanrei-comp-avatar-label-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-avatar-motion-picture-duration sys.motion.role.state.default 250ms
--tanrei-comp-avatar-motion-picture-easing sys.motion.easing.state cubic-bezier(0.2, 0, 0, 1)
--tanrei-comp-avatar-label-typescale-large sys.typescale.heading-3 500 20px/1.4
--tanrei-comp-avatar-label-typescale-medium sys.typescale.label 500 14px/1.4286
--tanrei-comp-avatar-label-typescale-small sys.typescale.caption 500 11px/1.4545

फ़िक्स्चर

मानक रेंडरिंग। हर प्लैटफ़ॉर्म हर फ़िक्स्चर का स्नैपशॉट एक ही ID से लेता है, ताकि नतीजों की तुलना की जा सके।

इससे जनरेट किया गया: specs/avatar.spec.json, tokens/comp/avatar.tokens.json, design/tokens/

दिशानिर्देश

कब इस्तेमाल करें

अवतार वहाँ इस्तेमाल करें जहाँ एक छोटी तस्वीर लोगों को अकेले नाम से ज़्यादा जल्दी बता देती है कि कोई चीज़ किसकी या किससे जुड़ी है: बायलाइन, टिप्पणी, लोगों की लिस्ट की पंक्ति, प्रोफ़ाइल का ऊपरी हिस्सा। यह तस्वीर है और इससे ज़्यादा कुछ नहीं। इसमें न होवर है, न फ़ोकस, न दबाना, न कोई इवेंट।

आपको चाहिए क्या इस्तेमाल करें
किसी व्यक्ति पर एक बिंदु या गिनती (“3 अपठित”) अवतार के चारों ओर एक बैज।
ऐसा अवतार जो प्रोफ़ाइल पर ले जाए एक लिंक, जिसके भीतर अवतार हो।
ऐसा अवतार जो मेन्यू खोले एक बटन, जिसके भीतर अवतार हो।
ऐसा व्यक्ति जिसे चुना या हटाया जा सके एक चिप।
मौजूदगी (ऑनलाइन, दूर) नाम के बग़ल में शब्द, और जहाँ निशान चाहिए वहाँ एक टैग।

यह क्या बनाता है

अवतार इनमें से वह पहली चीज़ बनाता है जो उसके पास है:

  1. src की तस्वीर, लोड हो जाने के बाद।
  2. आपके दिए हुए initials।
  3. उसके icon स्लॉट का ग्लिफ़।
  4. सिस्टम का अपना ग्लिफ़: गोले के लिए एक व्यक्ति, चौकोर के लिए एक सादा निशान।

बॉक्स पहली बार बनने से ही अपना साइज़ बनाए रखता है। जब तक तस्वीर लोड होती है, उसकी जगह फ़ॉलबैक बनता है, और तस्वीर आने पर धीरे-धीरे उभरती है, जबकि फ़ॉलबैक उसी समय धीरे-धीरे मिटता है। जो तस्वीर ब्राउज़र के पास पहले से है, वह तुरंत बनती है। अवतार के आसपास कुछ नहीं हिलता। जो तस्वीर लोड नहीं हो पाती, उसकी जगह फ़ॉलबैक बना रहता है: टूटी तस्वीर का कोई निशान नहीं दिखता, और अवतार तस्वीर दोबारा नहीं माँगता।

नाम के पहले अक्षर

अवतार नाम से पहले अक्षर ख़ुद नहीं बनाता। किसी नाम को कौन-से अक्षर दिखाते हैं, यह उसकी लिपि पर और इस पर निर्भर करता है कि नाम का कौन-सा हिस्सा पहले आता है, और यह आपका प्रॉडक्ट पहले से जानता है। उन्हें initials में दें:

नाम initials
Ada Lovelace AL
山田 花子 山 या 山田
王小明 王
ليلى حسن لح
किरण राव किरा

अवतार ज़्यादा से ज़्यादा दो अक्षर बनाता है, उसी तरह गिने हुए जैसे पढ़ने वाला उन्हें गिनता है, इसलिए मात्रा या चिह्नों वाला अक्षर या संयुक्ताक्षर कभी बीच से नहीं कटता। वह उन्हें वैसे ही बनाता है जैसे वे लिखे गए हैं, और उनका अपरकेस या लोअरकेस नहीं बदलता।

कई लिपियों में नाम के पहले अक्षर

साइज़ और शेप

size भुजा किसके लिए
small 24 टेक्स्ट की एक पंक्ति के बग़ल में: बायलाइन, टेबल का सेल, उल्लेख।
medium (डिफ़ॉल्ट) 40 लिस्ट की पंक्ति, टिप्पणी।
large 56 किसी व्यक्ति के अपने पेज या कार्ड का ऊपरी हिस्सा।
shape किसके लिए
circle (डिफ़ॉल्ट) एक व्यक्ति।
square ऐसी चीज़ जो कोई एक व्यक्ति नहीं है: टीम, प्रोजेक्ट, संगठन, बॉट।

हर फ़ॉलबैक का वही हल्का फ़िल होता है। हर व्यक्ति का अलग रंग नहीं होता: जिस रंग का कोई मतलब नहीं, वह सिस्टम में नहीं है।

तस्वीर

  • ऐसी चौकोर तस्वीर दें जो अवतार की भुजा से कम से कम दोगुनी हो, ताकि वह ज़्यादा डेंसिटी वाली स्क्रीन पर साफ़ रहे। दूसरे अनुपात की तस्वीर अपने केंद्र के चारों ओर क्रॉप की जाती है।
  • loading="lazy" तस्वीर तब तक नहीं माँगता जब तक अवतार विंडो के पास न आ जाए। इसे लंबी लिस्ट में इस्तेमाल करें।
  • referrerpolicy और crossorigin तस्वीर को वैसे ही दिए जाते हैं जैसे आप उन्हें लिखते हैं। अवतार दोनों में से कुछ नहीं चुनता: तस्वीर के होस्ट को आपके पेज के बारे में क्या बताया जाए, यह आपका फ़ैसला है।

ग्रुप

ग्रुप अपने सदस्यों को एक पंक्ति के रूप में बनाता है। हर सदस्य अपने से पहले वाले पर थोड़ा-सा (साइज़ के हिसाब से 2, 4 या 8) चढ़ा रहता है, ताकि साथ-साथ रखे दो पहले अक्षर पूरे दिखें और ग़लत न पढ़े जाएँ, और हर एक के चारों ओर सरफ़ेस के रंग का एक गैप होता है।

ऐसा ग्रुप जो उन्हें भी गिनता है जो उसे दिए नहीं गए

  • max बताता है कि ग्रुप ज़्यादा से ज़्यादा कितने बॉक्स बनाता है, बाक़ी की गिनती वाले बॉक्स को मिलाकर। max="4" के साथ छह सदस्य, तीन सदस्य और “+3” बनते हैं। ग्रुप कभी “+1” नहीं बनाता: उसमें सिर्फ़ एक चेहरा छिपाने पर एक बॉक्स ख़र्च हो जाता।
  • जहाँ आप ग्रुप को असल से कम सदस्य देते हैं, वहाँ total असली गिनती है। तीन सदस्य, max="4" और total="240", तीन सदस्य और “99+” बनते हैं: 99 से ऊपर हर साइज़ में बॉक्स “99+” दिखाता है, इसलिए उसमें तीन से ज़्यादा अक्षर कभी नहीं होते। सही गिनती overflow-label में दें, वही पढ़कर सुनाई जाती है।
  • ग्रुप अपना size और shape हर सदस्य को देता है।
  • पेज की सरफ़ेस के अलावा किसी दूसरी सरफ़ेस पर --tanrei-comp-avatar-group-outline-color को उस सरफ़ेस का रंग दें।
  • बाक़ी की गिनती वाला बॉक्स टेक्स्ट है, कंट्रोल नहीं। जहाँ लोगों को देखना हो कि और कौन-कौन है, वहाँ ग्रुप के बग़ल में एक लिंक या बटन रखें।

स्क्रिप्ट के आने से पहले

<tanrei-avatar> अपने शैडो रूट में बनता है, इसलिए सर्वर पर रेंडर हुआ पेज स्क्रिप्ट चलने तक उसकी जगह कुछ नहीं दिखाता। @tanrei/web/avatar.css लोड करें, तो हर अवतार अपने साइज़ और शेप का बॉक्स बनाए रखता है, और पेज नहीं हिलता। तब तक न तस्वीर दिखती है, न पहले अक्षर, न नाम। जिस पेज को बिना स्क्रिप्ट के पढ़ा जा सकना चाहिए, उसमें नाम को टेक्स्ट के रूप में सजावटी अवतार के बग़ल में लिखें।

max वाला ग्रुप, जब तक स्क्रिप्ट सदस्यों को गिन नहीं लेती, आपका दिया हुआ हर सदस्य दिखाता है। अगर इससे पेज नहीं हिलना चाहिए, तो ग्रुप को सिर्फ़ वे सदस्य दें जिन्हें वह बनाता है, और बाक़ी को total के रूप में दें।

करें

  • अकेले रहने वाले हर अवतार को label दें: पूरा नाम।
  • जो अवतार टेक्स्ट में लिखे उसी नाम के बग़ल में है, उस पर decorative सेट करें।
  • हर व्यक्ति को initials दें, ताकि तस्वीर न हो या देर से आए, तब भी दिखे कि वह कौन है।
  • पूरे प्रॉडक्ट में एक तरह की चीज़ के लिए एक ही शेप रखें।

न करें

  • अवतार पर हैंडलर न लगाएँ। उसे लिंक या बटन में रखें, जिसके पास स्टेट और फ़ोकस इंडिकेटर हैं।
  • लेबल में “की फ़ोटो” न लिखें। लेबल नाम ही है।
  • स्थिति दिखाने के लिए अपना कोई रंग, रिंग या बिंदु इस्तेमाल न करें। गिनती बैज है, और मौजूदगी शब्दों में कही जाती है।
  • सजावटी तस्वीर या हेडिंग के लोगो के लिए अवतार इस्तेमाल न करें। वह किसी ऐसे व्यक्ति या चीज़ के लिए है जिसके नाम से लोग काम करते हैं।

सुलभता

रोल
img
लेबलिंग
An avatar that stands alone is an image named by label, the full name of the person or the thing, whatever it draws; the initials, the glyph and the picture's address are never read. An avatar beside the same name in visible text is decorative and hidden. A group is a group named by its label, holding one named image for each member it draws and, last, the overflow's text (overflowLabel, or the drawn count). Inside a link or a Button, the avatar's label is part of that element's name.
न्यूनतम टार्गेट
दिखने वाला आकार छोटा होने पर भी हिट एरिया न्यूनतम टार्गेट साइज़ को पूरा करता है। minimum 32px · pointer 44px · spacing 8px · touch 48px

कीबोर्ड

कुंजियाँ क्रिया

टिप्पणियाँ

  • Not interactive: the avatar takes no input and no focus (AVT-7), so there is no target to size and minimumTarget holds trivially. An avatar that is pressed is inside a link or a Button, and that element meets the minimum target by its own spec; a small (24) avatar alone in a link needs the link's target, not its own box, to be large enough.
  • Decorative or named is the product's decision and cannot be seen from the avatar: beside "Ada Lovelace" in text a named avatar would be read as "Ada Lovelace, image, Ada Lovelace". The rule the docs page gives: if deleting the avatar loses a name, it is named; otherwise it is decorative.
  • The name is the name, not a description of the picture: "Ada Lovelace", never "Photo of Ada Lovelace" and never the initials.
  • Contrast in the default system: the initials, the count and the glyph are on-surface-variant on surface-container-highest, a pair the token invariants hold to 4.5:1 for secondary content on every surface tone. The fill against the surface around it is not held to a ratio: the avatar is not a control, and what it says is its name.
  • A picture brings its own colors, which the avatar does not check. A picture with a pale edge on a pale surface loses its outline; the avatar draws no ring around a picture, so a product whose pictures are often pale chooses the square or gives the surface behind them a tone.
  • A badge on an avatar (AVT-12) says that something is waiting, in the badge's one color and with the badge's label in words. Presence (online, away, busy) is a status that a color alone would carry; say it in words beside the name, with a tag where it needs a mark.
  • Forced colors (AVT-13): every fallback gains an edge in the text color; pictures are left alone.
  • A group's overflow box is text, not a control. Where the people it counts matter (who else can see this), the product lists them: a link or a Button beside the group that opens the full list.

इससे जनरेट किया गया: specs/avatar.spec.json, tokens/sys/measure.tokens.json

कंपोनेंट क्या सँभालता है

  • अकेला होने पर यह एक इमेज है जिसका नाम label से आता है, चाहे वह तस्वीर बनाए, पहले अक्षर या ग्लिफ़। पहले अक्षर, ग्लिफ़ का नाम और तस्वीर का पता कभी नहीं पढ़े जाते।
  • decorative के साथ यह सहायक तकनीक से छिपा रहता है।
  • लिंक या बटन के भीतर इसका लेबल उस एलिमेंट का नाम बन जाता है, और अवतार को दबाना उसी एलिमेंट तक पहुँचता है।
  • इसके चारों ओर का बैज अवतार के नाम के बाद बैज का लेबल जोड़ता है।
  • ग्रुप एक ग्रुप है जिसका नाम उसके label से आता है। उसमें हर उस सदस्य के लिए नाम वाली एक इमेज होती है जिसे वह बनाता है, दिए गए क्रम में, और उसके बाद बाक़ी की गिनती का टेक्स्ट। जिन सदस्यों को वह नहीं बनाता, वे सहायक तकनीक को नहीं दिए जाते।
  • यह न कोई इनपुट लेता है, न फ़ोकस, इसलिए फ़ोकस के क्रम में कोई पड़ाव नहीं जोड़ता।
  • बड़े किए गए टेक्स्ट के साथ यह अपना बॉक्स बनाए रखता है, जैसे आइकन रखता है। इसके पहले अक्षर टेक्स्ट के साथ तब तक बढ़ते हैं जब तक वे अपने साइज़ के ग्लिफ़ बॉक्स को न भर दें, और उसके अंदर पूरे रहते हैं।
  • फ़ोर्स्ड कलर्स मोड में हर फ़ॉलबैक को टेक्स्ट के रंग का एक किनारा मिलता है। तस्वीर अपने रंग बनाए रखती है।
  • दाएँ से बाएँ वाले लेआउट में ग्रुप दाईं ओर से शुरू होता है। तस्वीर और पहले अक्षर कभी मिरर नहीं होते, और “+3” का प्लस का चिह्न अंकों से पहले ही रहता है।
  • बिना नाम का अवतार, दो से ज़्यादा अक्षरों वाले initials, लोड न हो पाने वाली तस्वीर, और अनजान साइज़ या शेप डीबग बिल्ड में रिपोर्ट किए जाते हैं।

आपको क्या करना है

  • हर अवतार के लिए तय करें कि वह नाम वाला है या सजावटी। नियम यह है: अगर अवतार हटाने से कोई नाम खो जाता है, तो वह नाम वाला है। वरना वह सजावटी है।
  • overflowLabel पेज की भाषा में एक बार लिखें, और संख्या की जगह {count} रखें (और {count} लोग) — समूह पर, या पूरे प्रोडक्ट के लिए setWords({ avatarGroupOverflowLabel }) से। समूह उन सदस्यों की संख्या भरता है जिन्हें वह नहीं दिखाता — 99+ दिखाने पर भी पूरी संख्या। ऐसा वाक्य लिखें जो हर संख्या के लिए सही हो, या जहाँ आपकी भाषा को किसी संख्या के लिए दूसरा रूप चाहिए, वहाँ संख्या के अनुसार बदलें। उसके बिना “+3” वैसे ही पढ़ा जाता है जैसे वह दिखता है।
  • लिंक के भीतर के छोटे अवतार को दबाने के लिए काफ़ी जगह दें। अवतार 24 चौड़ा है; न्यूनतम टार्गेट लिंक को ख़ुद पूरा करना होगा।
  • तस्वीर अपने रंग साथ लाती है। जहाँ तस्वीरें अक्सर किनारे पर फीकी होती हैं, वहाँ उनके पीछे की सरफ़ेस को एक टोन दें।