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

टैग

एक छोटे स्थिर लेबल से किसी श्रेणी या स्थिति का नाम बताता है — हल्के, outlined या filled रूप में, और जहाँ कोई स्थिति हो वहाँ उस स्थिति के रंगों में। यह टेक्स्ट है, कंट्रोल कभी नहीं।

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

अवलोकन

Web
tanrei-tag
schedule
SwiftUI
TanreiTag
radio_button_unchecked
Jetpack Compose
TanreiTag
radio_button_unchecked
Flutter
TanreiTag
radio_button_unchecked
React Native
Tag
radio_button_unchecked

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

तीन रूप, स्थिति के साथ और उसके बिना

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

वेब पर यह <tanrei-tag> है। बाक़ी प्लैटफ़ॉर्म ने इसे अभी इम्प्लीमेंट नहीं किया है।

इस्तेमाल

<tanrei-tag label="Beta"></tanrei-tag>
<tanrei-tag variant="outlined" label="डिज़ाइन"><span slot="icon">sell</span></tanrei-tag>

<!-- लेबल ख़ुद स्थिति बताता है। -->
<tanrei-tag status="error" label="विफल"></tanrei-tag>

<!-- लेबल स्थिति नहीं बताता: status-label उससे पहले पढ़ा जाता है ("त्रुटि, 3 बिल्ड") और दिखाया नहीं जाता। -->
<tanrei-tag status="error" status-label="त्रुटि" label="3 बिल्ड"></tanrei-tag>

<script type="module">
  import '@tanrei/web/components/tag';
</script>
import { Tag } from '@tanrei/react';

<Tag label="Beta" />
<Tag variant="outlined" label="डिज़ाइन"><span slot="icon">sell</span></Tag>
<Tag status="error" statusLabel="त्रुटि" label={`${failed} बिल्ड`} />

स्पेक

हर स्थिति में हर रूप

दो साइज़, एक ग्लिफ़, एक बिंदु

sellsell

संरचना

संरचना

वेब पैकेज जिस तरह फ़िक्स्चर tonal बनाता है, उसी के ऊपर बनाया गया।
भाग विवरण
1 container The shape that holds the label: at least the height of its size, a pill in the default system, filled in the tonal and filled looks and edged in the outlined look. It carries no state: nothing about it answers a pointer, a press or focus.
2 label The word or short phrase the tag shows, on one line.
3 icon · वैकल्पिक A leading glyph of the system's icon set that the product names (a category's mark, a status's mark). Decorative: the label says what the tag means.
4 dot · वैकल्पिक A small filled circle in the leading position, in the look's mark color: the lightest way to show a status beside its word. Drawn where the product asks for it and no glyph is given, and always on an outlined tag that has a status.
5 outline · वैकल्पिक The outlined look's edge: one hairline inside the container, the same in every status.

माप

माप

लंबाई टोकन मान (px)
container padding-inline tanrei.comp.tag.container.padding-inline.medium 8
container height tanrei.comp.tag.container.height.medium 24
वेब पैकेज जिस तरह फ़िक्स्चर tonal बनाता है, उसी के ऊपर बनाया गया।

प्रॉपर्टी

प्रॉपर्टी टाइप डिफ़ॉल्ट विवरण
label string "" The tag's text: a word or a short phrase ("Beta", "Out of stock"). It is what the tag draws and what assistive technology reads.
variant tonal | outlined | filled "tonal" How much the tag weighs. tonal: a quiet fill, the default. outlined: no fill and one hairline, for many tags close together. filled: a full fill, for the chosen one among its neighbours (the default among values, the required among fields) and for the one status that must not be missed.
status default | info | warning | error | success "default" What the tag reports, in the names the snackbar uses. default: a category or a neutral state, in the look's own colors. info, warning, error and success draw the look in that status's color roles. It changes colors only; the words are the label's and statusLabel's.
statusLabel string "" The status in words, in the product's language ("Error"), read by assistive technology before the label and not drawn. For a tag whose label does not itself say the status (an error tag that reads "3 builds"); a label that says it ("Failed") needs none. Ignored while status is default.
size small | medium "medium" Small (20 high, 12 text) follows a field's label, a table cell or a line of body text without making the line taller; medium (24 high, 14 text) stands beside a heading or by itself.
dot boolean false Draws the dot before the label, in the look's mark color. A glyph in the icon slot takes its place. An outlined tag with a status draws the dot whatever this says, because nothing else in that look shows the status.
disabled boolean false Draws the tag as part of something disabled — the label of a disabled field, a disabled row of a list, a disabled item of a menu — in its look's disabled colors, so that it fades with what it stands in. It changes nothing else: a tag takes no input and no focus, and what assistive technology hears of the disabled state it hears from the element the tag stands in. The component that holds the tag sets it (a Field does, for its requirement tag); a product sets it on a tag it places in a disabled element of its own.

स्लॉट

स्लॉट विवरण
icon The leading glyph: a glyph of the system's icon set, drawn through the platform's icon helper at the tag's glyph size.

स्टेट

व्यवहार

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

ID आवश्यकता
TAG-1 THE tag SHALL draw a container at least the height of its size (comp.tag.container.height.medium for medium, and so on) with corners comp.tag.container.shape, never larger than half the container's height (a pill where the value is sys.shape.corner.full, at any height the tag grows to) and eased by sys.shape.corner-smoothing, and lay out in one row its glyph or its dot, where it has one, and its label, comp.tag.container.gap apart; the start SHALL be padded by comp.tag.container.padding-inline-with-icon.medium where it holds the glyph or the dot and by comp.tag.container.padding-inline.medium where the label meets it, the end by comp.tag.container.padding-inline.medium, and the row's tallest item (the label's line or the glyph's box) SHALL be padded at the top and bottom by at least comp.tag.container.padding-block.medium (and so on for each size). THE tag SHALL be as wide as its content and its paddings, never wider than its layout gives it, and SHALL draw no elevation.
TAG-2 WHILE status is default THE tag SHALL fill its container with the container color of its variant and draw its label, and its glyph or dot, in that variant's label and icon colors: comp.tag.tonal.container.color, comp.tag.tonal.label.color and comp.tag.tonal.icon.color for tonal, and outlined's and filled's tokens of the same names (comp.tag.outlined.container.color, comp.tag.filled.container.color, and so on).
TAG-3 WHILE status is info, warning, error or success THE tag SHALL draw its container, its label and its glyph or dot from the parts of its variant prefixed with the status: for a tonal info tag comp.tag.tonal.info.container.color, comp.tag.tonal.info.label.color and comp.tag.tonal.info.icon.color; for outlined and filled, and for warning, error and success, their own tokens of the same names (comp.tag.outlined.error.icon.color, comp.tag.filled.success.container.color, and so on). A status SHALL change these colors only: the tag's size, shape, layout and edge stay those of its variant and size, and the tag SHALL NOT draw a glyph the product did not give.
TAG-4 WHILE variant is outlined THE tag SHALL draw an edge comp.tag.outline.width wide in comp.tag.outline.color inside its container's size, following its corners, in every status, without changing the tag's size or the place of its content; WHILE variant is tonal or filled it SHALL draw no edge. A status SHALL NOT color the edge: it is the system's one hairline.
TAG-5 THE tag SHALL set its label on one line in the text style of its size (comp.tag.label.typescale.medium for medium, and so on) and the label color of its look (TAG-2, TAG-3), SHALL NOT wrap it, and SHALL cut it with an ellipsis only when the layout gives the tag less width than the label needs, keeping its paddings and its glyph or dot whole; the full label SHALL remain what assistive technology reads.
TAG-6 WHERE the icon slot holds a glyph THE tag SHALL draw it before the label in a box of comp.tag.icon.size, centred on the label's line, in the icon color of its look (TAG-2, TAG-3), 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, SHALL keep it from assistive technology, and SHALL draw no mark of its own in its place.
TAG-7 WHILE dot is true and the icon slot is empty THE tag SHALL draw before the label a filled circle of diameter comp.tag.dot.size in the icon color of its look (TAG-2, TAG-3), centred on the label's line, a circle whatever corners the container has, and SHALL keep it from assistive technology; WHERE the icon slot holds a glyph THE tag SHALL draw the glyph and no dot.
TAG-8 WHILE variant is outlined and status is info, warning, error or success and the icon slot is empty THE tag SHALL draw the dot of TAG-7 whether dot is true or false, because an outlined tag keeps the surface's label color and the one hairline in every status, so its mark is the only place the status shows.
TAG-9 THE tag 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 or selected state and no disabled state of its own — disabled draws it as part of something disabled and changes nothing it does (TAG-21) — draws no state layer, no ripple and no focus indicator, and emits no event.
TAG-10 WHERE the tag is placed inside an element that takes input (a link, a button, a list item, a table row, a card that is pressed as a whole) THE tag SHALL let input over it reach that element, SHALL stay as it is drawn while that element is hovered, focused or pressed (the state is drawn by that element, on its own container), and SHALL add its text (TAG-11) to that element's content in reading order; it SHALL NOT become a second target inside it.
TAG-11 THE tag SHALL expose its label as plain text, read where the tag sits, with no role, name or state of its own; WHILE status is not default and statusLabel is not empty THE tag SHALL expose statusLabel before the label as part of that text, set apart so that the two are read as two phrases ("Error, 3 builds"), and SHALL NOT draw it; WHILE status is default THE tag SHALL ignore statusLabel. THE tag SHALL NOT expose its variant, its size or its status in any other way: a status is given in words or not at all.
TAG-12 WHEN label, status or statusLabel changes THE tag SHALL draw and expose the new value at once, without a motion, and SHALL NOT announce the change by itself.
TAG-13 THE tag SHALL lay itself out inline with the text or the row it is placed in, as one unbreakable box, with the baseline of its label on the baseline of the text beside it; WHILE the text size is enlarged THE tag SHALL grow its container with its label, keeping the height of its size as a minimum, its paddings, and its glyph box and its dot at comp.tag.icon.size and comp.tag.dot.size.
TAG-14 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 tag SHALL draw an edge comp.tag.outline.width wide in the platform's text color inside its container in every variant, and its label, glyph and dot in that text color, so that a look whose fill the mode removes is still a bounded label; the status SHALL then rest on the label's words and statusLabel alone.
TAG-15 WHERE the layout direction is right-to-left THE tag SHALL mirror the order of its content and apply its paddings by logical start and end, so that the glyph or the dot sits at the right of the label.
TAG-16 THE tag 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 tag is shown THE tag SHALL draw itself for the new direction at once, without a motion of its own, keeping what it shows.
TAG-17 WHERE the layout direction is right-to-left THE tag 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, size, color and fill nor the order TAG-15 gives. THE tag SHALL NOT mirror a glyph itself, and SHALL NOT mirror content the product gives as an image or a view of its own rather than by a glyph's name. The dot is never mirrored.
TAG-18 THE tag SHALL lay out its label as text of its own direction, isolated from the text around it: it takes the base direction of its first strong character, or the layout direction where it has none, so that a left-to-right word, a number with its sign or unit, a version and a date keep their own order in a right-to-left layout and reorder nothing beside them; THE tag SHALL still place the label by the layout direction, not by the text's own, and SHALL cut a label that does not fit (TAG-5) at the end of its own direction, so that a left-to-right label in a right-to-left layout loses its right end and never its beginning.
TAG-19 WHEN variant or size names a value that the active design system does not have, or status names a value this spec does not have, THE tag SHALL render with the default value (the default variant's or size's tokens, status default), and in debug builds report the unknown value.
TAG-20 IF label is empty THE tag SHALL draw nothing, take no space and expose nothing, and in debug builds report that a tag has no text: a glyph or a dot alone is not a tag. IF statusLabel is not empty while status is default THE tag SHALL ignore it and in debug builds report it.
TAG-21 WHILE disabled is true — the tag stands inside something disabled, and the component that holds it, or the product, says so — THE tag SHALL draw its fill, its label, its glyph and its dot from its look's disabled tokens (comp.tag.<variant>.disabled.container.color, comp.tag.<variant>.disabled.label.color and comp.tag.<variant>.disabled.icon.color, and their parts of each status), whatever its status, so that it fades with what it stands in and does not read as the one live part of a disabled whole; an outlined tag SHALL keep its edge and draw no fill. disabled SHALL change nothing else: the tag SHALL keep its size, its label and its place, take no input and no focus (TAG-9), and keep its text readable by assistive technology, which hears the disabled state from the element the tag stands in, never from the tag. WHERE the platform draws with a person's own forced colors THE tag SHALL draw its edge, its label, its glyph and its dot in the platform's color for disabled text (GrayText on the web) in place of its text color (TAG-14).

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

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

स्पेक Web SwiftUI Jetpack Compose Flutter React Native
कंपोनेंट tanrei-tag TanreiTag TanreiTag TanreiTag Tag
label · प्रॉपर्टी label title label label label
variant · प्रॉपर्टी variant variant variant variant variant
status · प्रॉपर्टी status status status status status
statusLabel · प्रॉपर्टी statusLabel statusLabel statusDescription statusSemanticLabel statusAccessibilityLabel
size · प्रॉपर्टी size size size size size
dot · प्रॉपर्टी dot showsDot showDot showDot dot
disabled · प्रॉपर्टी disabled isDisabled enabled enabled disabled
टिप्पणियाँ <tanrei-tag> with the label as the label attribute and the glyph in the icon slot. The host is display: inline-flex with vertical-align: baseline and no role, no tabindex and no listeners; pointer-events stay as they are, so a press over a tag inside a link or a button reaches that element (TAG-10). statusLabel is reflected as the status-label attribute and drawn as visually hidden text before the label in the shadow root, followed by a comma and a space (TAG-11); the glyph and the dot are aria-hidden. The label is one dir="auto" run with text-overflow: ellipsis (TAG-18). Under forced-colors: active the container takes a CanvasText border of the outline width (TAG-14). disabled is a reflected boolean attribute that draws the look's disabled tokens and nothing else: no aria-disabled, no inert, no listener (TAG-21); under forced-colors: active the edge and the text are GrayText. TanreiTag(_ title: String, variant:, status:, statusLabel:, size:, showsDot:, icon:), the glyph given by name through icon:. Not a Button and not focusable; allowsHitTesting(false) so a press reaches a row or a link that holds it. The view is one accessibility element whose label is statusLabel and the title joined by a comma, with the static text trait. isDisabled: (a parameter, not .disabled(_:), which would say the tag is a control): it draws the look's disabled tokens and changes nothing else (TAG-21). TanreiTag(label, variant, status, statusDescription, size, showDot, icon), the glyph given by name through icon. No clickable and no focusable modifier. The label's text semantics are replaced by statusDescription and the label joined by a comma where a status label is given; the glyph and the dot are cleared from semantics. enabled is the inverse flag: it draws the look's disabled tokens and changes nothing else (TAG-21). TanreiTag(label: …, variant:, status:, statusSemanticLabel:, size:, showDot:, icon:), the glyph given by name through icon. Wrapped in IgnorePointer, with no Focus. One Semantics(label:) over the drawn parts, which are excluded. enabled is the inverse flag: it draws the look's disabled tokens and changes nothing else (TAG-21). <Tag label="Beta" />; the glyph is the icon prop (a glyph name). pointerEvents="none" and not focusable. One accessible element with accessibilityRole="text" whose accessibilityLabel is the status label and the label joined by a comma. Follows the app's direction where an ancestor's is not known. disabled: it draws the look's disabled tokens and changes nothing else (TAG-21).

टोकन

टोकन किसका एलियास रिज़ॉल्व किया गया मान (लाइट)
--tanrei-comp-tag-container-gap sys.space.space50 4px
--tanrei-comp-tag-container-height-medium — 24px
--tanrei-comp-tag-container-height-small — 20px
--tanrei-comp-tag-container-padding-block-medium — 2px
--tanrei-comp-tag-container-padding-block-small — 2px
--tanrei-comp-tag-container-padding-inline-with-icon-medium sys.space.space75 6px
--tanrei-comp-tag-container-padding-inline-with-icon-small sys.space.space50 4px
--tanrei-comp-tag-container-padding-inline-medium sys.space.space100 8px
--tanrei-comp-tag-container-padding-inline-small sys.space.space75 6px
--tanrei-comp-tag-container-shape sys.shape.corner.full 9999px
--tanrei-comp-tag-dot-size sys.space.space100 8px
--tanrei-comp-tag-filled-container-color sys.color.primary #1b1b1b
--tanrei-comp-tag-filled-disabled-container-color — #1b1b1b · 12%
--tanrei-comp-tag-filled-disabled-error-container-color — #1b1b1b · 12%
--tanrei-comp-tag-filled-disabled-error-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-error-label-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-info-container-color — #1b1b1b · 12%
--tanrei-comp-tag-filled-disabled-info-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-info-label-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-label-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-success-container-color — #1b1b1b · 12%
--tanrei-comp-tag-filled-disabled-success-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-success-label-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-warning-container-color — #1b1b1b · 12%
--tanrei-comp-tag-filled-disabled-warning-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-disabled-warning-label-color — #1b1b1b · 38%
--tanrei-comp-tag-filled-error-container-color sys.color.error #cd262f
--tanrei-comp-tag-filled-error-icon-color comp.tag.filled.error.label.color #ffffff
--tanrei-comp-tag-filled-error-label-color sys.color.on-error #ffffff
--tanrei-comp-tag-filled-icon-color comp.tag.filled.label.color #ffffff
--tanrei-comp-tag-filled-info-container-color sys.color.info #3066cb
--tanrei-comp-tag-filled-info-icon-color comp.tag.filled.info.label.color #ffffff
--tanrei-comp-tag-filled-info-label-color sys.color.on-info #ffffff
--tanrei-comp-tag-filled-label-color sys.color.on-primary #ffffff
--tanrei-comp-tag-filled-success-container-color sys.color.success #077b32
--tanrei-comp-tag-filled-success-icon-color comp.tag.filled.success.label.color #ffffff
--tanrei-comp-tag-filled-success-label-color sys.color.on-success #ffffff
--tanrei-comp-tag-filled-warning-container-color sys.color.warning #9b5c00
--tanrei-comp-tag-filled-warning-icon-color comp.tag.filled.warning.label.color #ffffff
--tanrei-comp-tag-filled-warning-label-color sys.color.on-warning #ffffff
--tanrei-comp-tag-icon-size sys.icon.extra-small 16px
--tanrei-comp-tag-outline-color sys.color.outline-variant #000000 · 8%
--tanrei-comp-tag-outline-width sys.border.hairline 1px
--tanrei-comp-tag-outlined-container-color — #000000 · 0%
--tanrei-comp-tag-outlined-disabled-container-color — #000000 · 0%
--tanrei-comp-tag-outlined-disabled-error-container-color — #000000 · 0%
--tanrei-comp-tag-outlined-disabled-error-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-error-label-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-info-container-color — #000000 · 0%
--tanrei-comp-tag-outlined-disabled-info-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-info-label-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-label-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-success-container-color — #000000 · 0%
--tanrei-comp-tag-outlined-disabled-success-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-success-label-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-warning-container-color — #000000 · 0%
--tanrei-comp-tag-outlined-disabled-warning-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-disabled-warning-label-color — #1b1b1b · 38%
--tanrei-comp-tag-outlined-error-container-color comp.tag.outlined.container.color #000000 · 0%
--tanrei-comp-tag-outlined-error-icon-color sys.color.error #cd262f
--tanrei-comp-tag-outlined-error-label-color comp.tag.outlined.label.color #1b1b1b
--tanrei-comp-tag-outlined-icon-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-tag-outlined-info-container-color comp.tag.outlined.container.color #000000 · 0%
--tanrei-comp-tag-outlined-info-icon-color sys.color.info #3066cb
--tanrei-comp-tag-outlined-info-label-color comp.tag.outlined.label.color #1b1b1b
--tanrei-comp-tag-outlined-label-color sys.color.on-surface #1b1b1b
--tanrei-comp-tag-outlined-success-container-color comp.tag.outlined.container.color #000000 · 0%
--tanrei-comp-tag-outlined-success-icon-color sys.color.success #077b32
--tanrei-comp-tag-outlined-success-label-color comp.tag.outlined.label.color #1b1b1b
--tanrei-comp-tag-outlined-warning-container-color comp.tag.outlined.container.color #000000 · 0%
--tanrei-comp-tag-outlined-warning-icon-color sys.color.warning #9b5c00
--tanrei-comp-tag-outlined-warning-label-color comp.tag.outlined.label.color #1b1b1b
--tanrei-comp-tag-tonal-container-color sys.color.secondary-container #eeeeee
--tanrei-comp-tag-tonal-disabled-container-color — #1b1b1b · 12%
--tanrei-comp-tag-tonal-disabled-error-container-color — #1b1b1b · 12%
--tanrei-comp-tag-tonal-disabled-error-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-error-label-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-info-container-color — #1b1b1b · 12%
--tanrei-comp-tag-tonal-disabled-info-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-info-label-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-label-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-success-container-color — #1b1b1b · 12%
--tanrei-comp-tag-tonal-disabled-success-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-success-label-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-warning-container-color — #1b1b1b · 12%
--tanrei-comp-tag-tonal-disabled-warning-icon-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-disabled-warning-label-color — #1b1b1b · 38%
--tanrei-comp-tag-tonal-error-container-color sys.color.error-container #ffedeb
--tanrei-comp-tag-tonal-error-icon-color sys.color.error #cd262f
--tanrei-comp-tag-tonal-error-label-color sys.color.on-error-container #3a211f
--tanrei-comp-tag-tonal-icon-color comp.tag.tonal.label.color #262626
--tanrei-comp-tag-tonal-info-container-color sys.color.info-container #edf0ff
--tanrei-comp-tag-tonal-info-icon-color sys.color.info #3066cb
--tanrei-comp-tag-tonal-info-label-color sys.color.on-info-container #212839
--tanrei-comp-tag-tonal-label-color sys.color.on-secondary-container #262626
--tanrei-comp-tag-tonal-success-container-color sys.color.success-container #e2f6df
--tanrei-comp-tag-tonal-success-icon-color sys.color.success #077b32
--tanrei-comp-tag-tonal-success-label-color sys.color.on-success-container #1b2c1c
--tanrei-comp-tag-tonal-warning-container-color sys.color.warning-container #ffeee0
--tanrei-comp-tag-tonal-warning-icon-color sys.color.warning #9b5c00
--tanrei-comp-tag-tonal-warning-label-color sys.color.on-warning-container #362410
--tanrei-comp-tag-label-typescale-medium sys.typescale.label 500 14px/1.4286
--tanrei-comp-tag-label-typescale-small sys.typescale.label-small 500 12px/1.3333

फ़िक्स्चर

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

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

दिशानिर्देश

बैज, चिप या टैग

तीनों में फ़र्क़ एक ही बार, इस आधार पर किया जाता है कि वे क्या करते हैं:

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

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

रूप चुनना

variant क्या बनता है किसके लिए
tonal (डिफ़ॉल्ट) एक हल्का फ़िल। ज़्यादातर टैग।
outlined कोई फ़िल नहीं और एक बारीक रेखा। पास-पास रखे कई टैग: टेबल का कॉलम, श्रेणियों की सूची।
filled पूरा फ़िल। अपने पड़ोसियों में से चुना हुआ: मानों में डिफ़ॉल्ट, फ़ील्ड में ज़रूरी। और वह एक स्थिति भी, जो नज़र से चूकनी नहीं चाहिए।

स्थितियाँ

status का मान default, info, warning, error या success होता है। यह सिर्फ़ रंग बदलता है। outlined टैग हर स्थिति में सरफ़ेस के टेक्स्ट का रंग और अपनी बारीक रेखा बनाए रखता है, इसलिए वह हमेशा स्थिति के रंग में एक बिंदु (या आपका ग्लिफ़) बनाता है: स्थिति सिर्फ़ उसी निशान में दिखती है।

टैग अपने आप कोई स्थिति ग्लिफ़ नहीं बनाता। जहाँ उससे मदद मिले, वहाँ ग्लिफ़ का नाम दें, जैसे यह साइट अपनी स्थिति टेबल की छह स्थितियों के लिए करती है:

इस साइट की छह स्थितियाँ

radio_button_uncheckedscheduleclock_loader_40clock_loader_80check_circleblock

साइज़

size ऊँचाई टेक्स्ट किसके लिए
small 20 12 फ़ील्ड के लेबल के बग़ल में, टेबल के सेल में, बॉडी टेक्स्ट की पंक्ति में। इससे पंक्ति ऊँची नहीं होती।
medium (डिफ़ॉल्ट) 24 14 हेडिंग के बग़ल में, या अकेले।

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

किसी अक्षम चीज़ के भीतर

टैग की अपनी कोई अवस्था नहीं होती, पर वह किसी ऐसी चीज़ के भीतर खड़ा हो सकता है जो अक्षम है: अक्षम फ़ील्ड का लेबल, लिस्ट की अक्षम पंक्ति, मेन्यू का अक्षम आइटम। disabled उसे उसके रूप के अक्षम रंगों (comp.tag.<variant>.disabled.*) में दिखाता है, उसकी स्थिति चाहे जो हो, ताकि वह अपने भीतर रखने वाली चीज़ के साथ फीका पड़ जाए और उसका अकेला सक्रिय हिस्सा न लगे। यह और कुछ नहीं बदलता: टैग अपना साइज़ और अपने शब्द बनाए रखता है, और न इनपुट लेता है, न फ़ोकस। फ़ील्ड और फ़ील्ड ग्रुप अक्षम रहते अपने ज़रूरी या वैकल्पिक के टैग पर इसे सेट करते हैं; अपने किसी अक्षम एलिमेंट में रखे टैग पर इसे ख़ुद सेट करें।

सामान्य टैग और किसी अक्षम चीज़ के भीतर के टैग

करें

  • स्थिति शब्दों में कहें। “विफल” को और कुछ नहीं चाहिए; त्रुटि के रंगों में “3 बिल्ड” लिखे टैग को statusLabel चाहिए।
  • टैग को उसके लेबल के लिए जगह दें। जो लेबल नहीं समाता, वह एलिप्सिस के साथ काट दिया जाता है, और बाक़ी हिस्सा दिखाने के लिए टैग के पास न होवर है, न फ़ोकस।
  • जहाँ टैग एक ही समूह हों, जैसे किसी लेख की श्रेणियाँ, वहाँ उन्हें एक लिस्ट में रखें (वेब पर <ul> और <li>) और लिस्ट को नाम दें।

न करें

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

सुलभता

रोल
none
लेबलिंग
The tag has no role and no name of its own: it is text, read where it sits. What is read is label, preceded by statusLabel where the tag has a status and the product gave one ("Error, 3 builds"). The glyph and the dot are decorative and hidden. Inside a link, a button, a list item or a table cell the tag's text is part of that element's content.
न्यूनतम टार्गेट
दिखने वाला आकार छोटा होने पर भी हिट एरिया न्यूनतम टार्गेट साइज़ को पूरा करता है। minimum 32px · pointer 44px · spacing 8px · touch 48px

कीबोर्ड

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

टिप्पणियाँ

  • Not interactive: the tag takes no input and no focus (TAG-9), so there is no target to size. minimumTarget holds trivially. A label that must be pressed, selected or removed is a chip; one that leads somewhere is a link.
  • A status never rests on color alone (WCAG 1.4.1): the label says it ("Failed", "Stable"), or statusLabel adds it in words. The component cannot tell whether a label says its status, so this is the product's to check; the docs page says so with examples.
  • Several tags in a row are the product's to group: where they are a set (an article's categories), the product lays them out in its platform's list semantics (ul and li on the web) and names the list. The tag does not group itself and has no list role.
  • A tag does not announce a change of its text or status (TAG-12). Where a change must be announced (a build that finishes while the person watches), the product puts the tag in a live region or reports the change with a snackbar.
  • A label cut by TAG-5 is still read in full by assistive technology, but a person who sees the ellipsis has no way to read the rest from the tag itself: it takes no hover and no focus. Give a tag room for its label, or let the element that holds it (a table cell, a list item) show the full text.
  • Contrast in the default system: every label is a role drawn on its paired role (on-secondary-container on secondary-container, on-error-container on error-container, on-primary on primary, on-error on error, on-surface on a surface), each held to 4.5:1 by the token invariants. The status color used for a glyph or a dot keeps 3:1 against its status container and against every surface (it is held to 4.5:1 as text on surfaces). The outlined look's edge is decorative.
  • Forced colors (TAG-14): a filled or tonal tag loses its fill, so every look gains an edge in the text color. Statuses then look alike, which is why the status must be in words.

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

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

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

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

  • जाँचें कि हर टैग के शब्द उसकी स्थिति बताते हैं। कंपोनेंट यह नहीं जान सकता कि “3 बिल्ड” अच्छी ख़बर है या बुरी।
  • statusLabel पेज की भाषा में लिखें।
  • disabled सिर्फ़ उसी टैग पर सेट करें जो किसी अक्षम चीज़ के भीतर खड़ा है, और पक्का करें कि वह एलिमेंट यह बताता है (अक्षम कंट्रोल, या aria-disabled): फीका टैग उसी पर निर्भर है।
  • अगर किसी बदलाव को होते ही पढ़कर सुनाना ज़रूरी हो (ऐसा बिल्ड जो व्यक्ति के देखते-देखते पूरा होता है), तो टैग को लाइव रीजन में रखें या बदलाव की सूचना स्नैकबार से दें। टैग ख़ुद कुछ पढ़कर नहीं सुनाता।