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

कॉम्बोबॉक्स फ़ील्ड

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

content_copyMarkdown में देखें
श्रेणी
टेक्स्ट इनपुट
टोकन
comp.field
स्तर
संयोजित
इनसे बना है
Field, Combobox

अवलोकन

Web
tanrei-combobox-field
schedule
SwiftUI
TanreiComboboxField
radio_button_unchecked
Jetpack Compose
TanreiComboboxField
radio_button_unchecked
Flutter
TanreiComboboxField
radio_button_unchecked
React Native
ComboboxField
radio_button_unchecked
वे वेरिएंट जो इनमें शामिल नहीं
tanrei: filled, outlined

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

एक कॉम्बोबॉक्स फ़ील्ड जो अपने विकल्पों में से एक लेता है, और एक जो व्यक्ति का अपना मान भी लेता है

क्योटोलिस्बननैरोबीटोक्योटोरंटोInterNoto Sans JPRoboto MonoSource Serif 4

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

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

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

वेब पर यह <tanrei-combobox-field> है, जिसके चाइल्ड <tanrei-option> हैं, वही एलिमेंट जो सिलेक्ट में रहते हैं। बाक़ी प्लैटफ़ॉर्म ने इसे अभी इम्प्लीमेंट नहीं किया है।

इस्तेमाल

कॉम्बोबॉक्स फ़ील्ड में वही रहता है जो उसके कॉम्बोबॉक्स में रहता है, यानी दो चीज़ें। value कमिट किया गया चुनाव है: चुने हुए विकल्प का मान, या कोई कस्टम टेक्स्ट। inputValue वह टेक्स्ट है जो इनपुट में है। मान सिर्फ़ तब बदलता है जब व्यक्ति कोई विकल्प चुनता है, टेक्स्ट कमिट करता है (कोई विकल्प सक्रिय न होने पर Enter दबाकर, या फ़ील्ड छोड़कर) या मिटाने का बटन दबाता है। टाइप करने और लिस्ट में आगे-पीछे जाने से वह कभी नहीं बदलता।

<form>
  <tanrei-combobox-field name="city" label="शहर" value="tokyo" required required-text="ज़रूरी"
    clearable clear-label="शहर मिटाएँ" empty-text="कोई नतीजा नहीं">
    <tanrei-option value="kyoto">क्योटो</tanrei-option>
    <tanrei-option value="tokyo">टोक्यो</tanrei-option>
  </tanrei-combobox-field>
</form>

<!-- सिर्फ़ बॉक्स, जहाँ लेबल कहीं और है: एक कॉम्बोबॉक्स, जिसे नाम उसके अपने label से मिलता है। कॉम्बोबॉक्स फ़ील्ड को इंपोर्ट करने से वह डिफ़ाइन हो जाता है। -->
<tanrei-combobox label="टोकन" placeholder="टोकन खोजें" no-chevron style="inline-size: 16rem">
  <tanrei-option value="primary">primary</tanrei-option>
</tanrei-combobox>

<!-- विकल्प सुझाव हैं: जो टेक्स्ट किसी विकल्प का नाम नहीं है, वह मान बन जाता है। -->
<tanrei-combobox-field label="फ़ॉन्ट फ़ैमिली" value="Recursive" allow-custom-value>
  <tanrei-option value="Inter">Inter</tanrei-option>
</tanrei-combobox-field>

<!-- फ़िल्टर आप करते हैं: input पर, सर्वर से। स्थिति पंक्ति बताती है कि आपका सोर्स क्या कर रहा है। -->
<tanrei-combobox-field id="assignee" label="किसे सौंपें" filter="none" no-chevron placeholder="व्यक्ति खोजें">
  <span slot="leading-icon">person_search</span>
</tanrei-combobox-field>

<script type="module">
  import '@tanrei/web/components/combobox-field';

  const assignee = document.querySelector('#assignee');
  // व्यक्ति ने टेक्स्ट बदला। कॉम्बोबॉक्स इस इवेंट को न देर से भेजता है, न छोड़ता है: डिबाउंस ख़ुद करें।
  assignee.addEventListener('input', async () => {
    assignee.status = 'loading';
    assignee.statusText = 'लोग लोड हो रहे हैं';
    const people = await find(assignee.inputValue);
    assignee.replaceChildren(...people.map(option));
    assignee.status = 'idle';
    assignee.statusText = `${total} में से ${people.length} लोग दिखाए गए`;
  });
  // कमिट किया गया मान बदला। value में पहले से नया मान है।
  assignee.addEventListener('change', (e) => save(e.detail.value));
  // व्यक्ति ने खोला या बंद किया; बंद होने पर कारण भी आता है। यह बबल नहीं होता: ख़ुद फ़ील्ड पर सुनें।
  assignee.addEventListener('toggle', (e) => console.log(e.detail.open, e.detail.reason));
</script>
import { ComboboxField, Option } from '@tanrei/react';

<ComboboxField label="शहर" value={city} clearable clearLabel="शहर मिटाएँ" emptyText="कोई नतीजा नहीं" onChange={(event) => setCity(event.detail.value)}>
  <Option value="kyoto">क्योटो</Option>
  <Option value="tokyo">टोक्यो</Option>
</ComboboxField>

एक स्तर नीचे

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

<!-- कॉम्बोबॉक्स फ़ील्ड -->
<tanrei-combobox-field name="city" label="शहर" required required-text="ज़रूरी"
  supporting-text="ऑर्डर इसी शहर में भेजा जाता है।" value="tokyo">
  <tanrei-option value="kyoto">क्योटो</tanrei-option>
  <tanrei-option value="tokyo">टोक्यो</tanrei-option>
</tanrei-combobox-field>

<!-- वही, हाथ से: फ़्रेम की प्रॉपर्टी फ़ील्ड पर, बाक़ी सब कुछ, और विकल्प भी, कॉम्बोबॉक्स पर -->
<tanrei-field label="शहर" required required-text="ज़रूरी" supporting-text="ऑर्डर इसी शहर में भेजा जाता है।">
  <tanrei-combobox name="city" value="tokyo">
    <tanrei-option value="kyoto">क्योटो</tanrei-option>
    <tanrei-option value="tokyo">टोक्यो</tanrei-option>
  </tanrei-combobox>
</tanrei-field>

एक फ़ील्ड, जिसके भीतर एक कॉम्बोबॉक्स है: कॉम्बोबॉक्स फ़ील्ड जैसा ही दिखता है

क्योटोटोक्यो

फ़र्क़ इसमें है कि फ़ॉर्म का कंट्रोल कौन है: हाथ से लिखने पर वह कॉम्बोबॉक्स है, जो name लेता है; कॉम्बोबॉक्स फ़ील्ड में वह फ़ील्ड है।

स्पेक

ग्रुप, सहायक टेक्स्ट और एक अक्षम विकल्प, एक त्रुटि, सिर्फ़ पढ़ने वाला कॉम्बोबॉक्स फ़ील्ड और अक्षम कॉम्बोबॉक्स फ़ील्ड

टोक्योसियोललिस्बनबर्लिनमुफ़्तटीमएंटरप्राइज़नैरोबीटोक्योनैरोबीटोक्योनैरोबीटोक्यो

फ़ील्ड

भाग यह क्या है
लेबल कंटेनर के ऊपर फ़ील्ड की पंक्ति (stacked), या कंटेनर के भीतर फ़्लोट होता हुआ कॉम्बोबॉक्स का अपना लेबल (filled, outlined)। यही एक्सेसिबल नाम है, चाहे वह दिखाया गया हो या labelHidden से छिपाया गया हो
ज़रूरी या वैकल्पिक का निशान लेबल के बाद: required के लिए ज़रूरी का टैग, तारांकन या कुछ नहीं, और optional के लिए वैकल्पिक का टैग। फ़्लोट होते लेबल को तारांकन मिलता है
इनपुट टेक्स्ट: वह जो व्यक्ति कोई विकल्प खोजने के लिए टाइप करता है, और जब वह टाइप नहीं कर रहा होता, तब चुने हुए विकल्प का लेबल या कस्टम मान। एक पंक्ति, जो स्क्रॉल होती है
प्लेसहोल्डर वह संकेत जो इनपुट के ख़ाली रहने तक दिखता है। वह कभी लेबल नहीं होता, और कभी कोई मान नहीं होता
शुरुआती आइकन leading-icon स्लॉट का ग्लिफ़, और वह न हो तो चुने हुए विकल्प का अपना ग्लिफ़
मिटाने का बटन clearable के साथ, जब तक टेक्स्ट ख़ाली नहीं है: टेक्स्ट और मान दोनों को ख़ाली करता है
शेवरॉन बताता है कि फ़ील्ड के पास देखने के लिए एक लिस्ट है, और उसे खोलता और बंद करता है। वह घूमता नहीं। जहाँ सुझाव सिर्फ़ टाइप किए गए टेक्स्ट के लिए होते हैं, वहाँ इसे हटा दें (chevron false)
सहायक टेक्स्ट फ़ील्ड की पंक्ति: सहायता की एक पंक्ति। error के true रहते errorText उसकी जगह ले लेता है (जहाँ डिज़ाइन सिस्टम दोनों रखता है, वहाँ उसके नीचे)। दोनों वहीं से शुरू होते हैं जहाँ से इनपुट का टेक्स्ट

लेबल की पंक्ति, निशान और सहायक पंक्ति फ़ील्ड की हैं और फ़ील्ड के टोकन से बनती हैं; बाक़ी सब कुछ कॉम्बोबॉक्स का है। तीनों वेरिएंट और तीनों साइज़, small (32), medium (40) और large (56), टेक्स्ट फ़ील्ड के ही हैं। डिफ़ॉल्ट सिस्टम सिर्फ़ stacked देता है।

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

लिस्ट

लिस्ट कंटेनर के नीचे comp.combobox.list.offset की दूरी पर खुलती है, ठीक उसी जितनी चौड़ी, और जहाँ नीचे जगह नहीं होती वहाँ उसके ऊपर। वह list.max-height (320) तक अपनी पंक्तियों जितनी ऊँची होती है, और उसके बाद स्क्रॉल होती है।

भाग यह क्या है
विकल्प एक पंक्ति, जिसमें एक लेबल होता है, और चाहें तो सहायक टेक्स्ट की एक पंक्ति और एक ग्लिफ़। चुने हुए विकल्प पर हल्का फ़िल और चेक का निशान होता है
मिलान filter="contains" के साथ, हर लेबल का वह हिस्सा जो टेक्स्ट से मेल खाता है, ज़्यादा भारी वेट में बनाया जाता है
ग्रुप विकल्पों का एक सिलसिला, चाहें तो शीर्षक के साथ। जिस ग्रुप में फ़िल्टर के बाद कुछ नहीं बचता, वह दिखाया नहीं जाता
स्थिति पंक्ति विकल्पों के बाद: statusText, status के loading रहते एक लोडिंग इंडिकेटर, उसके error रहते विफलता, या जहाँ कुछ मेल नहीं खाया वहाँ emptyText

filter="contains" वे विकल्प दिखाता है जिनके लेबल में टेक्स्ट मौजूद है, चाहे अक्षर बड़े हों या छोटे, कैरेक्टर पूरी चौड़ाई का हो या आधी का, और अक्षर पर कोई भी चिह्न लगा हो। filter="none" के साथ कॉम्बोबॉक्स आपका दिया हर विकल्प दिखाता है और फ़िल्टर आप करते हैं, input पर। कॉम्बोबॉक्स कभी कुछ फ़ेच नहीं करता, इंतज़ार नहीं करता, और विकल्पों को न छाँटता है, न रैंक करता है।

टाइप करना, आगे-पीछे जाना और चुनना

इनपुट क्या होता है
टाइप करना टेक्स्ट बदलता है और लिस्ट फ़िल्टर होकर खुलती है। पहला मेल खाने वाला विकल्प सक्रिय विकल्प होता है, और टाइप करना रुकने पर पढ़ा जाता है; allowCustomValue के साथ कोई नहीं
Down Arrow, Up Arrow, लिस्ट बंद; शेवरॉन लिस्ट हर विकल्प के साथ खुलती है। चुना हुआ विकल्प सक्रिय विकल्प होता है, या पहला सक्षम विकल्प
Down Arrow, Up Arrow, लिस्ट खुली अगला या पिछला विकल्प, ग्रुप के पार भी, और सिरों पर घूमकर (allowCustomValue के साथ टेक्स्ट से होकर); wrap false हो तो सिरों पर रुककर
Page Down, Page Up दस विकल्प नीचे या ऊपर
Home, End, Left Arrow, Right Arrow टेक्स्ट में कैरेट को ले जाती हैं
Enter, जब कोई विकल्प सक्रिय है; किसी विकल्प को दबाना वह विकल्प चुना जाता है और लिस्ट बंद हो जाती है। इससे फ़ॉर्म सबमिट नहीं होता
Enter, जब कोई विकल्प सक्रिय नहीं है टेक्स्ट कमिट होता है, action एमिट होता है, और अगर action रद्द नहीं किया गया तो फ़ॉर्म सबमिट होता है
Escape खुली लिस्ट को बंद करती है और टेक्स्ट को रहने देती है। दोबारा दबाने पर कमिट किए गए मान का टेक्स्ट लौटा देती है। वह कभी कोई मान नहीं मिटाती
Tab; बाहर दबाना फ़ोकस फ़ील्ड से बाहर जाता है: टेक्स्ट से मान तय होता है और लिस्ट बंद हो जाती है। सक्रिय विकल्प चुना नहीं जाता
लेबल को दबाना फ़ोकस इनपुट पर जाता है और कुछ नहीं खुलता। लिस्ट खुली हो, तो यह कॉम्बोबॉक्स के बाहर दबाना है: लिस्ट बंद हो जाती है, और फ़ोकस इनपुट में ही रहता है

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

फ़ोकस मिलने पर लिस्ट नहीं खुलती। अगर आप ऐसा चाहते हैं, तो open ख़ुद सेट करें।

जब तक इनपुट मेथड कंपोज़ कर रहा है, हर कुंजी उसी की है। जो Enter किसी कन्वर्ज़न की पुष्टि करती है, वह न कुछ चुनती है और न कुछ सबमिट करती है।

toggle के साथ बंद होने का कारण आता है: select, commit, escape, outside, press, tab, focus-out, anchor-hidden या empty।

संरचना

संरचना

वेब पैकेज जिस तरह फ़िक्स्चर stacked-empty बनाता है, उसी के ऊपर बनाया गया।
भाग विवरण
1 field The Field: the label row with its glyph and its requirement mark, and the supporting row with the help and the error text. In a look whose combobox floats the label it draws no label row.
2 combobox The combobox, as the Field's one control: the box and the text typed in it, the leading glyph, the clear button and the chevron, the list with its options, groups and status row, and the label that floats in the box in the looks that float one.

प्रॉपर्टी

प्रॉपर्टी टाइप डिफ़ॉल्ट विवरण
variant stacked | filled | outlined "stacked" The text input's three looks, so that a combobox is drawn as the text inputs beside it: stacked is a filled box that shows focus and error with a line inside its edge and draws no label of its own; filled and outlined float the label inside the box. Use one style per form. A design system may leave some out (the Tanrei system ships stacked only) or add values. — Combobox
size small | medium | large "medium" Minimum height of the container: stacked 32 / 40 / 56, as tall as a Button of the same size, so that the box and a Button side by side in one row stand as tall as each other; filled and outlined 40 / 48 / 56, which hold the label that floats inside them. These are the text input's three sizes, small for a bar, a toolbar or a dense row of controls. The hit area always meets the minimum target. A design system may add values. — Combobox
value string "" The committed choice: the chosen option's value, or, with allowCustomValue, a text the person typed that names no option. Empty while nothing is chosen. It is one string, for ever: several values are another component. — Combobox Held by the combobox, which changes it by a choice, a commit or the clear button; the combobox field's is the same at every moment (CBF-3).
inputValue string "" The text in the input. The combobox writes it as the person types and when a value is chosen or restored; the product may set it, and reads it from input to load options. — Combobox Held by the combobox, which writes it as the person types and when a value is chosen or restored; the combobox field's is the same at every moment (CBF-3).
label string "" Names the control, visibly and to assistive technology. Required, unless the control names itself (a checkbox or a switch with its own label): then leave it empty and the field adds only help and an error. — Field Names the combobox. In a filled or outlined look the combobox draws it, floating in its box, and the Field draws no label row (FLD-25, CMB-8).
labelHidden boolean false Does not draw the label, which stays the accessible name. For a control whose visible label is elsewhere (a table column, a toolbar). — Field Hides the label wherever it would be drawn: the Field's row, or the combobox's floating label (FLD-25).
placeholder string "" A hint shown while the input is empty and no label is in the input line. Never a replacement for a name. — Combobox
supportingText string "" Help shown below the control and given to assistive technology as the control's description. While the field is in error it gives way to errorText, unless the design system keeps both (comp.field.error-text.placement append). — Field
errorText string "" Shown while error is true, in supportingText's place — or below it, which then stays, where the design system's comp.field.error-text.placement is append: what is wrong and how to put it right, in words. — Field
error boolean false Puts the field in the error condition: the error text is drawn, the control is exposed as invalid and, where it has an error condition of its own, drawn in it. What a value means is the product's to validate; the field never sets this itself. — Field Puts the Field in its error condition, which puts the combobox in its own (FLD-8, CMB-10).
disabled boolean false Disables the control and draws the frame as disabled. Disable a framed control here, not on the control, so that its label follows. — Field Disables the Field, which disables the combobox (FLD-14, CMB-46).
readOnly boolean false The value is shown, can be focused, selected and copied, and is submitted, but cannot be changed: the list does not open and neither the chevron nor the clear button is drawn. — Combobox
required boolean false What the form asks of the control: true exposes it as required and draws the required mark beside the label. It never validates: a missing answer is the product's to report with error. — Field
optional boolean false Draws the optional tag after the label and adds optionalText to the control's description, because assistive technology has no state for it. Ignored while required is true: a control is never both. — Field
requiredMark auto | tag | asterisk | none "auto" How this control shows that it is required: tag is a small filled Tag with requiredText, asterisk is "*" after the label, none draws nothing and keeps the semantics. Auto takes comp.field.requirement.mark, which follows sys.behavior.requirement-mark, the system's one answer. Ignored unless required is true. — Field
requiredText string "" The text of the required tag, in the product's language ("Required", "必須"). The product's: Tanrei has no word for it. Empty reads the product's words; with neither, FLD-24 says what is drawn. — Field
optionalText string "" The text of the optional tag, in the product's language ("Optional", "任意"); also read to assistive technology as part of the description. The product's: Tanrei has no word for it. Empty reads the product's words. — Field
open boolean false Whether the list is shown. The combobox opens and closes itself and emits toggle; the product may also set it (to open on focus, for one). Ignored while the combobox is disabled or read-only or has nothing to show. — Combobox Held by the combobox, which opens and closes its list itself; the combobox field's is the same at every moment (CBF-3).
allowCustomValue boolean false False: the value is always one of the options, and a text that names none is given up when the person leaves. True: the options are suggestions, and a text that names none becomes the value as typed (a font family, a tag, an address). — Combobox
filter contains | none "contains" Who decides which options answer the text. contains: the combobox shows the options whose label contains what was typed, ignoring case, and marks the match. none: the combobox shows every option it is given and the product filters — on input, from its own data or a server — and says what it is doing with status. — Combobox
wrap boolean true Whether the arrow keys go round at the ends of the list: Down Arrow on the last option to the first, Up Arrow on the first to the last — with allowCustomValue true, through the text itself, where no option is active (CMB-26). False stops them at the ends. — Combobox
chevron boolean true Draws the chevron that opens the whole list without typing. False for a field whose suggestions exist only for what was typed (a remote search): there is no list to look through. — Combobox
clearable boolean false Draws a clear button while the text is not empty, for a combobox whose value may be none. Without it, emptying the text and leaving the field clears the value. — Combobox
clearLabel string "" The clear button's accessible name, in the product's language ("Clear"). Required while clearable is true. — Combobox
status idle | loading | error "idle" What the product's source of options is doing, which the product sets: idle (the options given are final), loading (options are on their way: the status row shows a loading indicator), error (the source failed: the status row shows statusText in the error color). — Combobox
statusText string "" The status row's text, in the product's language, announced to assistive technology when it changes: a count ("12 of 340 shown"), that loading failed, or, while status is loading, the loading indicator's name ("Loading options"). — Combobox
emptyText string "" Shown in the list while the text names nothing the combobox can show, allowCustomValue is false and no status is set, in the product's language ("No matches"). The product's: Tanrei has no words for it. Empty reads the product's words; with neither, no such row is drawn and it is reported (CMB-32). — Combobox
separation auto | divider | gap "auto" How a group of options is told from what is next to it. divider: a line between them. gap: empty space and no line. Auto takes comp.combobox.separation, which follows the design system's choice. — Combobox
iconSpace auto | always | never "auto" Whether a shown option keeps the room of the leading icon column where it has no icon, so that the labels of a section start on one line — a section being the shown options of a group, or a run of adjacent shown options outside any group. auto: an option keeps the column while another shown option of its section has a leading icon; an option the filter hides does not count. always: every option keeps it. never: only an option that has an icon has the column. The menu's and the select's iconSpace, with the same values and default (CMB-67). — Combobox
density regular | compact "regular" How much room an option of the list takes: its least height, its paddings, the gap between its columns and the size of its glyphs (the leading icon, the check), and never its text style. regular (a 48 row in the default system) is for a product used by touch as well as by pointer; compact (a 32 row with 20 glyphs, the menu's compact row) is for a tool used with a pointer, whose lists are long. For touch an option is never lower than the touch target in either (CMB-34). The field's own box is not changed: its height is size's. A design system may add values. — Combobox

स्लॉट

स्लॉट विवरण
leading-icon A glyph at the start of the container that stands for the combobox whatever is chosen (a magnifier before a field that searches people). It takes the place of the chosen option's own glyph. — Combobox
label-icon A glyph before the label. — Field

इवेंट

इवेंट विवरण
input The person changed the text (typing, deleting, pasting, dictating, the clear button, Escape restoring it); carries the new text. Not emitted when the product sets inputValue or value, or when a choice writes its label. It is the product's cue to load options; the combobox does not delay or drop it. — Combobox
change The committed value changed by the person: an option was chosen, a custom text was committed, or the value was cleared; carries the new value and the text now shown. Not emitted when the product sets value, when the chosen option is chosen again, or while the person only types or moves through the list. — Combobox
toggle The list was opened or closed by the person or by having nothing left to show; carries the new open and, for a close, the reason: select, commit, escape, back, outside, press, tab, focus-out, anchor-hidden or empty (in the platform's casing). After a choice it follows change. — Combobox
action The person pressed Enter with no option active and the text was committed; emitted after any change it caused. On the web it is followed by the form's submission unless cancelled. — Combobox

आइटम

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

option

One choice of the combobox: a label, the value it stands for, and optionally a supporting line and a glyph. The same kind a select holds.

प्रॉपर्टी टाइप डिफ़ॉल्ट विवरण
label string "" The option's text and its accessible name: what the filter searches and what the input shows once the option is chosen. Required.
value string "" Identifies the choice: the option is the chosen one while the combobox's value equals it. Unique within the combobox and not empty: the empty value means that nothing is chosen.
supportingText string "" A line below the label that says more about the choice. Shown in the list, not in the input; not searched.
leadingIcon string "" The name of an icon (a glyph of the system's icon set) before the label; the container shows it too while the option is chosen and the combobox has no leading icon of its own.
disabled boolean false Prevents the option from being chosen. It stays reachable with the arrow keys.
स्पेक Web SwiftUI Jetpack Compose Flutter React Native
आइटम tanrei-option TanreiComboboxOption TanreiComboboxOption TanreiComboboxOption ComboboxOption
label · प्रॉपर्टी label title text label label
value · प्रॉपर्टी value tag value value value
supportingText · प्रॉपर्टी supportingText supportingText supportingText supportingText supportingText
leadingIcon · प्रॉपर्टी leadingIcon leadingIcon leadingIcon leadingIcon leadingIcon
disabled · प्रॉपर्टी disabled disabled enabled enabled disabled
टिप्पणियाँ <tanrei-option value="tokyo">Tokyo</tanrei-option>: the element a select holds, and the same data: the label is the label attribute or, without one, the element's text. Attributes supporting-text, leading-icon, disabled. It draws nothing itself. tanrei-option and tanrei-option-group are one pair of elements for the select and the combobox, defined once; an option with the empty value is refused by the combobox (CMB-17, CMB-57), not by the element, because a select allows it. TanreiComboboxOption(_ title:, supportingText:, leadingIcon:).tag(value); disabled follows .disabled(_:). TanreiComboboxOption(text, value, supportingText, leadingIcon, enabled), called in the combobox's content lambda. TanreiComboboxOption<String>(value:, label:, supportingText:, leadingIcon:, enabled:), in the combobox's options list, as DropdownMenuEntry. { label, value, supportingText?, leadingIcon?, disabled? }: an element of the options array.

option-group · ग्रुप — इसमें आइटम होते हैं

A run of related options, optionally titled. The combobox separates a group from what is next to it by a divider or a gap, and draws neither a group nor its title while the filter leaves it empty.

प्रॉपर्टी टाइप डिफ़ॉल्ट विवरण
title string "" A short heading drawn above the group's options, which also names the group; empty draws none and leaves the group unnamed.
स्पेक Web SwiftUI Jetpack Compose Flutter React Native
आइटम tanrei-option-group TanreiComboboxSection TanreiComboboxGroup TanreiComboboxGroup ComboboxOptionGroup
title · प्रॉपर्टी label title title title title
टिप्पणियाँ The title is the label attribute, as <optgroup label>: a title attribute would also draw the browser's tooltip. TanreiComboboxSection(_ title:) { … }, as Section. TanreiComboboxGroup(title) { … }. TanreiComboboxGroup(title:, options: […]), in the same list. { kind: 'group', title?, options: ComboboxOption[] } in the same array.

स्टेट

व्यवहार

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

ID आवश्यकता
CBF-1 THE combobox field SHALL be a Field that frames one combobox, and nothing else. It SHALL give label, labelHidden, supportingText, errorText, error, disabled, required, optional, requiredMark, requiredText and optionalText to its Field and every other prop to its combobox, each unchanged; SHALL hold the label-icon slot for its Field and the leading-icon slot for its combobox; SHALL give its options to its combobox (CBF-2); and SHALL emit its combobox's events as its own, each once. THE combobox field SHALL be as wide as the place it stands in, and its combobox SHALL fill it: it is a block with no width of its own, as its Field is (FLD-1), around a control that fills the width it is given (CMB-49). It SHALL draw no part of its own and have no token of its own: what it shows, how it behaves and what it exposes to assistive technology SHALL be exactly what that Field and that combobox do when a product places the one in the other (FLD-1 to FLD-28; CMB-1 to CMB-62) — the label row and its requirement mark (FLD-2 to FLD-6), or the label that floats in the box with the Field's row left out (FLD-25, CMB-7, CMB-8); the supporting row and the error (FLD-7 to FLD-9, FLD-26, CMB-10); the name, the description and the states (FLD-10, FLD-11, FLD-14, CMB-12, CMB-46); and the list, which is the combobox's alone and as wide as its container (CMB-22).
CBF-2 THE combobox field SHALL take the options and the option groups a product gives it — in the platform's form for a combobox's own (its child elements on the web) — and give them to its combobox as that combobox's options, in the order given, each with its label, its value, its supporting text, its leading icon and its disabled, and each group with its title: the option a product wrote SHALL be the option its combobox reads, never a copy of it. THE combobox field SHALL NOT read, filter, order, count or keep an option, and SHALL make no option active or chosen: which options are shown, which is active and which is the chosen one are its combobox's (CMB-25, CMB-26, CMB-36). WHEN the product adds, removes, reorders or changes an option or a group THE combobox field's combobox SHALL meet the change at once and as CMB-31 says, as though the product had changed that combobox's own options.
CBF-3 THE combobox field SHALL hold no value, no text and no open state of its own: its value, its inputValue and its open SHALL at every moment be its combobox's. WHEN its combobox changes one of them — a choice, a commit or the clear button (CMB-17, CMB-20, CMB-27 to CMB-29); typing, or a text the combobox writes itself for a choice, for a commit that was given up or for Escape (CMB-16, CMB-27, CMB-29, CMB-30); the list opening or closing, or open taken back because there is nothing to show (CMB-21, CMB-30, CMB-57) — THE combobox field's SHALL be the new one before any event that reports the change is emitted, and equally WHERE no event reports it. WHEN the product sets one on the combobox field THE combobox field SHALL set it on its combobox and nothing else, so that no event follows (CMB-31).
CBF-4 WHERE the platform has forms (the web) THE combobox field SHALL be the one control the form sees: it SHALL take name, submit its combobox's value — never the text of an edit that was not committed — reset to the value it was first given, restore it on navigation, report to the form's constraint validation exactly what its combobox would report there (CMB-59), and be left out WHILE disabled is true or a disabled group of the form holds it; its combobox and its Field SHALL take no part in the form themselves. WHEN Enter asks for the form's submission (CMB-28) the form asked SHALL be the combobox field's own, through that form's default button (BTN-30), and not WHEN action was cancelled.
CBF-5 WHEN the combobox field is given focus — by the product, by a press on any part of it that FLD-12 or CMB-14 gives to the input, or by a form that reports its validity — THE combobox field SHALL pass the focus to its combobox's input and SHALL add no stop to the focus order: the stops inside it are its combobox's, in that combobox's order (the input, then the clear button while it is shown). WHILE focus is anywhere inside it, or its combobox's list is open, its Field's rows SHALL be drawn focused, because its combobox says so to its Field (FLD-13, CMB-61): the combobox field arranges nothing for it. A press on its Field's label row WHILE the list is open is a press outside the combobox: the list SHALL close with the reason outside, choosing nothing (CMB-30), and focus SHALL go to the input (FLD-12).
CBF-6 IF the combobox field is placed in a Field THE combobox field SHALL in debug builds report that it is a field already and that the bare control is the combobox, and both SHALL still render (FLD-15). WHILE it stands in a field group THE combobox field SHALL follow that group's disabled, through its own Field, and take nothing else from the group (FGR-20).
CBF-7 THE combobox field SHALL have no words of its own and SHALL read none: requiredText and optionalText are read by its Field (FLD-24), emptyText and clearLabel by its combobox (CMB-60), each from the instance's prop and then from the product's words.
CBF-8 WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE combobox field SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on the element that carries its role — an id reference by the elements it names in the host's tree or a tree around it, an error message as part of the description while the combobox field is invalid — except those the combobox field owns (aria-label, aria-labelledby, aria-disabled, aria-haspopup, aria-expanded, aria-controls), which it SHALL move and not expose: its name is label (CBF-1). WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE combobox field SHALL take it off that element. WHEN the product sets an aria- attribute the combobox field owns THE combobox field SHALL report it in debug builds.

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

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

स्पेक Web SwiftUI Jetpack Compose Flutter React Native
कंपोनेंट tanrei-combobox-field TanreiComboboxField TanreiComboboxField TanreiComboboxField ComboboxField
variant · प्रॉपर्टी variant variant variant variant variant
size · प्रॉपर्टी size size size size size
value · प्रॉपर्टी value selection value value value
inputValue · प्रॉपर्टी inputValue text inputValue controller inputValue
label · प्रॉपर्टी label label label labelText label
labelHidden · प्रॉपर्टी labelHidden labelsHidden labelHidden labelHidden labelHidden
placeholder · प्रॉपर्टी placeholder prompt placeholder hintText placeholder
supportingText · प्रॉपर्टी supportingText supportingText supportingText helperText supportingText
errorText · प्रॉपर्टी errorText errorText errorText errorText errorText
error · प्रॉपर्टी error error isError isError error
disabled · प्रॉपर्टी disabled disabled enabled enabled disabled
readOnly · प्रॉपर्टी readOnly readOnly readOnly readOnly readOnly
required · प्रॉपर्टी required isRequired required required required
optional · प्रॉपर्टी optional isOptional optional optional optional
requiredMark · प्रॉपर्टी requiredMark requiredMark requiredMark requiredMark requiredMark
requiredText · प्रॉपर्टी requiredText requiredText requiredText requiredText requiredText
optionalText · प्रॉपर्टी optionalText optionalText optionalText optionalText optionalText
open · प्रॉपर्टी open isPresented expanded menuController open
allowCustomValue · प्रॉपर्टी allowCustomValue allowCustomValue allowCustomValue allowCustomValue allowCustomValue
filter · प्रॉपर्टी filter filter filter filter filter
wrap · प्रॉपर्टी wrap wrap wrap wrap wrap
chevron · प्रॉपर्टी noChevron chevron chevron chevron chevron
clearable · प्रॉपर्टी clearable clearable clearable clearable clearable
clearLabel · प्रॉपर्टी clearLabel clearLabel clearContentDescription clearSemanticLabel clearAccessibilityLabel
status · प्रॉपर्टी status status status status status
statusText · प्रॉपर्टी statusText statusText statusText statusText statusText
emptyText · प्रॉपर्टी emptyText emptyText emptyText emptyText emptyText
separation · प्रॉपर्टी separation separation separation separation separation
iconSpace · प्रॉपर्टी iconSpace iconSpace iconSpace iconSpace iconSpace
density · प्रॉपर्टी density density density density density
input · इवेंट input text onInputValueChange onInputChanged onInputValueChange
change · इवेंट change selection onValueChange onChanged onValueChange
toggle · इवेंट toggle isPresented onExpandedChange onOpenChanged onOpenChange
action · इवेंट action onSubmit keyboardActions onSubmitted onSubmitEditing
टिप्पणियाँ The tag tanrei-combobox-field, the class TanreiComboboxField, the React name ComboboxField. It takes the combobox's attributes, children and listeners and the Field's, name for name. The element is composed as every composed element on the web is (the web package's README, Composed elements); what follows is what is particular to it, and the three places where this element needs more than every composed element has. Members: <tanrei-field> holding one <tanrei-combobox> in its default slot; the product places no member. The host is display: block. Value member: tanrei-combobox. The host is the form's element — name, the value and its state, validity anchored on the combobox's input, reset to the value attribute, restore, form, a disabled fieldset — and the combobox inside has no name. Props, set as properties on the member each is from. On the Field: label, labelHidden, supportingText, errorText, error, disabled, required, optional, requiredMark, requiredText, optionalText. On the combobox: variant, size, value, inputValue, placeholder, readOnly, open, allowCustomValue, filter, noChevron (the inverse of chevron, attribute no-chevron), clearable, clearLabel, status, statusText, emptyText, separation. Attributes are the members' own: kebab-case, except readonly. Props of one name on both members — label, labelHidden, error, disabled — are the Field's; the combobox's are never set by the element and reach the combobox through the connection. **1. Three props the member writes** (a composed element sets each prop on its member, with one exception, the value, which it reads back on the member's event): the combobox writes value, inputValue and open itself, and writes the text with no event when a commit is given up (CMB-29). The host therefore keeps no copy of the three: each is an accessor over the member's property — a get reads the member's, a set writes the member's, and a value set before the member exists is kept and given at its first render — so that event.target.value, .inputValue and .open are the new ones in every listener and between events (CBF-3). open reflects on the host as it does on the member: the host writes its own attribute when the member tells it of an update, by the primitive through which the member already tells the host its form value. **2. The options are passed by the default slot** (other passed-on children use named slots): the shadow root is <tanrei-field><slot name="label-icon" slot="label-icon"></slot><tanrei-combobox><slot></slot><slot name="leading-icon" slot="leading-icon"></slot></tanrei-combobox></tanrei-field>. The product's <tanrei-option> and <tanrei-option-group> children stay the host's light-DOM children and are assigned to the unnamed <slot>, which is a child of the combobox; the combobox reads a <slot> among its children as the elements assigned to it and reads again on slotchange and on a change of an assigned element (primitives/option-list.ts, the combobox's web note; the select reads its options the same way, with the same reader). Unlike a passing named slot, the unnamed one is always rendered: the combobox draws no room for options, so an empty slot is no option. The host never reads its option children. Slots: label-icon is passed to the Field and leading-icon to the combobox, each by a slot element of the same name rendered only while the host has a child for it. **3. A forwarded attribute that is no prop**: inline, the combobox's web-only attribute that draws an open list in place for the fixtures, is forwarded as a property, and select() is passed on as focus() and blur() are. Events: input is the native, composed event of the text element, and change and action are the combobox's own composed, bubbling events; the three leave by themselves, with the host as their target, and action stays cancelable. toggle is composed and does not bubble: it is heard on the host, as on any shadow host, and by no ancestor — which needs the combobox's toggle to be composed, as it is not today (the combobox's web note). None is stopped and none is copied. Parts: the member hosts are field and combobox. Exported from the Field: label, label-icon, requirement-label, supporting-text. Exported from the combobox: container, outline, active-indicator, label, requirement-label, input, leading-icon, clear-button, chevron, list, option, option-label, option-supporting-text, option-leading-icon, mark, group, group-title, divider, status. Two names collide, label and requirement-label. Each is exported with its member's name before it, always (field-label, combobox-label, field-requirement-label, combobox-requirement-label), and under the bare name from both members as well, because the two are one thing to a person and are never drawn at once: FLD-25 is the sentence that holds it. Focus: the shadow root does not delegate. focus(), blur() and select() call the combobox's; a press on the label row focuses the input by FLD-12, a press on the box by CMB-14, and a press on the help does nothing. The combobox's list is a popover of the combobox's own shadow root, in the top layer; the combobox is its opener, so a press on the Field's rows while it is open is a press outside (CBF-5). The connection is the Field's with its control, with one value more upward, that the control is drawn focused (FLD-13, FLD-25, FLD-26, CMB-61); the element takes no part in it. Parts and tokens of its own: none. The element writes no custom property: --tanrei-comp-field-*, --tanrei-comp-input-box-* and --tanrei-comp-combobox-* reach the members by inheritance, and one combobox field is set apart by setting any of them on the element. What its twin cannot do that it does: nothing. The twin: <tanrei-field label="City" supporting-text="Where the order is sent." required><tanrei-combobox name="city" value="tokyo"><tanrei-option value="kyoto">Kyoto</tanrei-option><tanrei-option value="tokyo">Tokyo</tanrei-option></tanrei-combobox></tanrei-field>. Before the element is defined its options are running text: a page hides them with tanrei-combobox-field:not(:defined) > * { display: none } and gives the tag a block size. Words: none of its own; required-text and optional-text are read by the Field, empty-text and clear-label by the combobox. TanreiComboboxField("City", selection: $city, text: $query) { TanreiComboboxOption("Tokyo").tag("tokyo") … }: a view built from TanreiField and TanreiCombobox, with the combobox's two bindings and its content builder passed through and the Field's arguments beside them. It takes TanreiCombobox's arguments, name for name. One instance is set apart by .tanreiTheme(_:) on the view. The options are TanreiComboboxOption and TanreiComboboxSection, the combobox's own. Planned, after the Field and the combobox. TanreiComboboxField(value, onValueChange, label = "City") { TanreiComboboxOption("Tokyo", "tokyo") … }: a composable that calls TanreiField with TanreiCombobox as its content and passes the content lambda through. enabled is the inverse flag and isError keeps Compose's name. One instance is set apart by TanreiTheme(…) { } around it. Planned, after the Field and the combobox. TanreiComboboxField(value:, onChanged:, labelText:, helperText:, errorText:, options: […]): a widget that builds TanreiField around TanreiCombobox and passes options through; labelText, hintText, helperText, errorText and enabled keep InputDecoration's names, enabled the inverse flag. TanreiComboboxFormField wraps the combobox field as a FormField<String>. One instance is set apart by a TanreiTheme around it. Planned, after the Field and the combobox. <ComboboxField label="City" supportingText="Where the order is sent." value={city} onValueChange={setCity} options={[…]} />: a component that renders Field around Combobox and passes options through as given. inputValue / onInputValueChange and open / onOpenChange are the combobox's optional pairs. One instance is set apart by a provider around it. Planned, after the Field and the combobox.

टोकन

टोकन किसका एलियास रिज़ॉल्व किया गया मान (लाइट)
--tanrei-comp-field-counter-gap sys.space.space200 16px
--tanrei-comp-field-error-text-gap sys.space.space50 4px
--tanrei-comp-field-error-text-placement — 0
--tanrei-comp-field-label-icon-gap sys.space.space100 8px
--tanrei-comp-field-label-icon-size sys.icon.small 20px
--tanrei-comp-field-label-gap sys.space.space100 8px
--tanrei-comp-field-motion-state-duration sys.motion.role.state.default 250ms
--tanrei-comp-field-motion-state-easing sys.motion.easing.state cubic-bezier(0.2, 0, 0, 1)
--tanrei-comp-field-requirement-asterisk-gap sys.space.space25 2px
--tanrei-comp-field-requirement-gap sys.space.space100 8px
--tanrei-comp-field-requirement-mark sys.behavior.requirement-mark 0
--tanrei-comp-field-standard-counter-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-standard-disabled-counter-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-error-text-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-error-counter-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-error-label-icon-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-error-label-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-error-required-asterisk-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-error-supporting-text-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-error-value-text-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-label-icon-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-label-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-required-asterisk-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-supporting-text-color — #1b1b1b · 38%
--tanrei-comp-field-standard-disabled-value-text-color — #1b1b1b · 38%
--tanrei-comp-field-standard-error-text-color sys.color.error #cd262f
--tanrei-comp-field-standard-error-counter-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-standard-error-label-icon-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-standard-error-label-color sys.color.on-surface #1b1b1b
--tanrei-comp-field-standard-error-required-asterisk-color sys.color.primary #1b1b1b
--tanrei-comp-field-standard-error-supporting-text-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-standard-error-value-text-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-standard-focused-counter-color — #4b4b4b
--tanrei-comp-field-standard-focused-error-text-color — #cd262f
--tanrei-comp-field-standard-focused-error-counter-color — #4b4b4b
--tanrei-comp-field-standard-focused-error-label-icon-color — #4b4b4b
--tanrei-comp-field-standard-focused-error-label-color — #1b1b1b
--tanrei-comp-field-standard-focused-error-required-asterisk-color — #1b1b1b
--tanrei-comp-field-standard-focused-error-supporting-text-color — #4b4b4b
--tanrei-comp-field-standard-focused-error-value-text-color — #4b4b4b
--tanrei-comp-field-standard-focused-label-icon-color — #4b4b4b
--tanrei-comp-field-standard-focused-label-color — #1b1b1b
--tanrei-comp-field-standard-focused-required-asterisk-color — #1b1b1b
--tanrei-comp-field-standard-focused-supporting-text-color — #4b4b4b
--tanrei-comp-field-standard-focused-value-text-color — #4b4b4b
--tanrei-comp-field-standard-label-icon-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-standard-label-color sys.color.on-surface #1b1b1b
--tanrei-comp-field-standard-required-asterisk-color sys.color.primary #1b1b1b
--tanrei-comp-field-standard-supporting-text-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-standard-value-text-color sys.color.on-surface-variant #4b4b4b
--tanrei-comp-field-supporting-text-gap sys.space.space50 4px
--tanrei-comp-field-value-text-gap sys.space.space200 16px
--tanrei-comp-field-label-typescale sys.typescale.label 500 14px/1.4286
--tanrei-comp-field-supporting-text-typescale sys.typescale.label-small 500 12px/1.3333
--tanrei-comp-field-value-text-typescale sys.typescale.label 500 14px/1.4286

फ़िक्स्चर

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

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

वेब क्या अलग ढंग से बनाता है

  • <tanrei-option> और <tanrei-option-group> डेटा हैं: वे कुछ नहीं बनाते। ये वही एलिमेंट हैं जो सिलेक्ट में रहते हैं। जिस विकल्प का मान ख़ाली स्ट्रिंग है, वह दिखाया जाता है पर चुना नहीं जा सकता, क्योंकि ख़ाली मान का मतलब है कि कुछ नहीं चुना गया।
  • एलिमेंट के शैडो रूट में एक <tanrei-combobox> के चारों ओर एक <tanrei-field> है। आपके <tanrei-option> चाइल्ड उसके अपने चाइल्ड बने रहते हैं और एक स्लॉट से होकर कॉम्बोबॉक्स तक पहुँचते हैं; न कुछ खिसकाया जाता है, न कॉपी किया जाता है।
  • कॉम्बोबॉक्स फ़ील्ड फ़ॉर्म से जुड़ा एलिमेंट है: वही एक कंट्रोल जो फ़ॉर्म को दिखता है। वह name लेता है, value सबमिट करता है और उस संपादन का टेक्स्ट कभी नहीं जो कमिट नहीं हुआ, रीसेट होने पर value ऐट्रिब्यूट पर लौटता है, और जब तक required है और value ख़ाली है, फ़ॉर्म को बताता है कि मान नहीं है। कोई विकल्प सक्रिय न होने पर Enter उसका फ़ॉर्म सबमिट करती है।
  • value, inputValue और open हर पल कॉम्बोबॉक्स के ही होते हैं: हर लिसनर में हर एक में पहले से नया मान होता है।
  • chevron और wrap के ऐट्रिब्यूट उलटे अर्थ वाले no-chevron और no-wrap हैं, और readOnly का readonly।
  • input टेक्स्ट एलिमेंट का नेटिव इवेंट है। change और action के साथ detail.value और detail.inputValue आते हैं। चारों इवेंट कॉम्बोबॉक्स के अपने हैं, जिनका टार्गेट कॉम्बोबॉक्स फ़ील्ड है; toggle बबल नहीं होता।
  • focus() इनपुट पर जाता है। एलिमेंट पर ख़ुद फ़ोकस नहीं जा सकता और उसका कोई रोल नहीं है: उसे label से नाम दें, aria-label से कभी नहीं।
  • भाग: field और combobox दोनों सदस्य हैं; हर सदस्य के भाग अपने ही नामों से एक्सपोर्ट होते हैं, और label और requirement-label इन नामों से भी: field-label, combobox-label, field-requirement-label और combobox-requirement-label।
  • किसी एक फ़ील्ड को उसी पर लगी कस्टम प्रॉपर्टी से अलग किया जाता है: पंक्तियों के लिए --tanrei-comp-field-*, बॉक्स के लिए --tanrei-comp-input-box-*, लिस्ट के लिए --tanrei-comp-combobox-*।
  • लिस्ट टॉप लेयर में एक popover="manual" एलिमेंट है। बाहर दबाना उसे बंद करता है और उसके नीचे के एलिमेंट तक भी पहुँचता है।
  • स्थिति पंक्ति विकल्पों के नीचे रहती है और उनके साथ स्क्रॉल नहीं होती, इसलिए कोई गिनती या विफलता नज़र में रहती है।
  • एलिमेंट के डिफ़ाइन होने से पहले उसके विकल्प पेज पर चलते टेक्स्ट की तरह रहते हैं। tanrei-combobox-field:not(:defined) > * को छिपाएँ और ऊँचाई के लिए जगह रखें।
  • वेब का अपना कोई बैक जेस्चर नहीं है, इसलिए toggle के साथ back कारण कभी नहीं आता।

दिशानिर्देश

कॉम्बोबॉक्स फ़ील्ड, सिलेक्ट, खोज या टेक्स्ट फ़ील्ड

पहलू कॉम्बोबॉक्स फ़ील्ड सिलेक्ट खोज टेक्स्ट फ़ील्ड
इसमें क्या रहता है टाइप करके खोजा गया एक मान बंद लिस्ट का एक मान एक क्वेरी कोई भी टेक्स्ट
विकल्प कब दिखते हैं व्यक्ति के टाइप करने के साथ दबाने के बाद सुझाव और नतीजे नहीं दिखते
ऐसा मान लेता है जो लिस्ट में नहीं है allowCustomValue के साथ नहीं हाँ हाँ
फ़ॉर्म का हिस्सा हाँ हाँ नहीं हाँ
  1. जब लगभग पाँच तक छोटे विकल्प हों, तो सभी दिखाएँ: रेडियो बटन।
  2. अगर लिस्ट इतनी छोटी है कि उस पर नज़र दौड़ाई जा सके, और बंद है, तो वह सिलेक्ट है।
  3. अगर लोग स्क्रॉल करने के बजाय टाइप करना चाहेंगे, या फ़ील्ड ऐसा मान भी लेता है जो लिस्ट में नहीं है, तो वह कॉम्बोबॉक्स फ़ील्ड है।
  4. अगर टाइप करना किसी मान तक नहीं, जाने की जगहों तक ले जाता है, तो वह खोज है।
  5. कई मानों के लिए कोई दूसरा कंपोनेंट है: कॉम्बोबॉक्स में एक ही मान रहता है।
  6. अगर लेबल कहीं और है, जैसे टूलबार का फ़िल्टर या टेबल का कोई सेल, तो वह अकेला कॉम्बोबॉक्स है, जिसे नाम उसके अपने label से मिलता है।

करें

  • ऐसा लेबल लिखें जो बताए कि क्या चुना जा रहा है, और फ़ॉर्म में उसे दिखता रहने दें।
  • allowCustomValue सिर्फ़ वहाँ इस्तेमाल करें जहाँ लिस्ट से बाहर का मान सचमुच एक जवाब है।
  • जिस कॉम्बोबॉक्स फ़ील्ड का मान ख़ाली भी हो सकता है, उसे clearable दें, और बटन को clearLabel से नाम दें।
  • जब आप विकल्प लोड करते हैं, तो status और statusText सेट करें, ताकि लिस्ट बताए कि वह इंतज़ार कर रही है, कितने विकल्प दिखा रही है, या विफल हुई है।
  • emptyText दें, कॉम्बोबॉक्स फ़ील्ड पर या setWords({ emptyText }) से पूरे प्रॉडक्ट के लिए एक बार। Tanrei अपना कोई शब्द साथ नहीं देता: इसके बिना जिस टेक्स्ट से कुछ मेल नहीं खाता, उसके लिए कोई पंक्ति नहीं बनती, और लिस्ट के पास दिखाने को कुछ नहीं होता।

न करें

  • प्लेसहोल्डर को लेबल की तरह इस्तेमाल न करें। व्यक्ति के टाइप करते ही वह ग़ायब हो जाता है।
  • input पर कुछ सेव न करें, किसी दूसरे पेज पर न ले जाएँ और फ़ॉर्म सबमिट न करें। वह हर कुंजी दबाने पर फ़ायर होता है; कमिट किया गया मान change में है।
  • जो टेक्स्ट किसी विकल्प का नाम नहीं है, उसे फ़ील्ड की त्रुटि न मानें। व्यक्ति के फ़ील्ड छोड़ने पर वह छोड़ दिया जाता है। अगर आप “लिस्ट में से एक चुनें” कहना चाहते हैं, तो error और errorText ख़ुद सेट करें।
  • कॉम्बोबॉक्स फ़ील्ड को फ़ील्ड के भीतर न रखें। वह पहले से एक फ़ील्ड है; फ़ील्ड जिस कंट्रोल को फ़्रेम देता है, वह कॉम्बोबॉक्स है।
  • कई फ़ील्ड वाले फ़ॉर्म में फ़ोकस मिलने पर लिस्ट न खोलें: वह हर पड़ाव पर नीचे के फ़ील्ड ढक देती है।

सुलभता

रोल
combobox
लेबलिंग
The combobox field adds nothing to what its members expose and coordinates nothing: the Field gives the combobox its name, its description and its required, invalid and disabled states (FLD-8, FLD-10, FLD-11, FLD-14), and the combobox carries them on its own input, with its expanded state, its list and its active option (CMB-12, CMB-48). Assistive technology meets one editable combobox named by label, with a list of the same name, exactly as it meets a Field around a combobox written by hand.
न्यूनतम टार्गेट
दिखने वाला आकार छोटा होने पर भी हिट एरिया न्यूनतम टार्गेट साइज़ को पूरा करता है। minimum 32px · pointer 44px · spacing 8px · touch 48px

कीबोर्ड

कुंजियाँ क्रिया
Every key The combobox's (its accessibility block; CMB-16, CMB-20, CMB-21, CMB-26 to CMB-30). The combobox field handles no key and adds no focus stop (CBF-5).

टिप्पणियाँ

  • One level down is the same thing: a Field with a combobox in it, holding the same options. Every fixture has that pair as its twin, and the accessibility tree of the two is the same (CBF-1).
  • The options are the product's, and they are the combobox's: the combobox field passes them on and does nothing with them (CBF-2). Value, text and open are the combobox's too, and the combobox field keeps no second copy that could disagree with it (CBF-3).
  • On the web the two members stand in the combobox field's own shadow root, so the form meets the combobox field and not the combobox (CBF-4); focus passes through to the input (CBF-5); and the product's option elements stay its own children, read by the combobox through a slot.
  • A list is not a second thing the component reports: choosing an option is setting its one value, so the combobox field is composed, not a feature.

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

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

  • इनपुट एक ऐसा कॉम्बोबॉक्स है जिसमें टाइप करके संपादन किया जा सकता है, और जिसके साथ एक लिस्टबॉक्स है। उसका नाम label है, चाहे वह दिखाया गया हो या छिपाया गया हो, और प्लेसहोल्डर कभी नहीं। फ़ील्ड उसे कॉम्बोबॉक्स को देता है, जो उसे अपने इनपुट पर रखता है।
  • दिखाया जा रहा सहायक या त्रुटि टेक्स्ट उसका विवरण है, और जब तक फ़ील्ड वैकल्पिक है, optionalText भी उसमें जुड़ता है।
  • जो त्रुटि फ़ील्ड में फ़ोकस रहते हुए आती है, उसे एक बार, बिना टोके (polite), पढ़कर सुनाया जाता है।
  • जब तक error true है, वह अमान्य के रूप में दिया जाता है; जब तक required सेट है, ज़रूरी के रूप में; सिर्फ़ पढ़ने के लिए हो तो सिर्फ़ पढ़ने वाले के रूप में; और जब तक उसकी लिस्ट खुली है, फैले हुए (expanded) के रूप में।
  • लिस्ट खुली रहते फ़ोकस इनपुट में ही रहता है। सक्रिय विकल्प उसका सक्रिय डिसेंडेंट है, इसलिए टाइप करने पर टेक्स्ट का संपादन कभी नहीं रुकता। टाइप करने से सक्रिय हुए विकल्प का नाम तब दिया जाता है जब टाइप करना आधा सेकंड रुक जाए, ताकि स्क्रीन रीडर पहले टाइप किया गया अक्षर पढ़े और फिर वह विकल्प जिसे Enter चुनेगा; ऐरो कुंजियाँ जिस विकल्प पर ले जाती हैं, उसका नाम तुरंत दिया जाता है।
  • लिस्ट एक लिस्टबॉक्स है, जिसका नाम लेबल से आता है। हर विकल्प का अपना नाम और अपना विवरण होता है, और यह भी कि वह चुना हुआ है या नहीं, अक्षम है या नहीं, और दिखाए जा रहे विकल्पों के बीच उसकी जगह क्या है। ग्रुप का नाम उसके शीर्षक से आता है।
  • मिलान वेट से चिह्नित होता है, सिर्फ़ रंग से कभी नहीं। लेबल एक ही टेक्स्ट के रूप में पढ़ा जाता है।
  • स्थिति पंक्ति एक लाइव रीजन है: उसका टेक्स्ट बदलने पर बिना टोके (polite) पढ़कर सुनाया जाता है, और सोर्स के विफल होने पर तुरंत। लोड होते समय लिस्ट व्यस्त (busy) के रूप में चिह्नित रहती है और कुछ पढ़कर नहीं सुनाया जाता।
  • जब तक इनपुट मेथड कंपोज़ कर रहा है, कॉम्बोबॉक्स कोई कुंजी नहीं सँभालता।
  • शेवरॉन पॉइंटर के लिए और छूकर एक्सप्लोर करने के लिए एक बटन है, जो फ़ोकस के क्रम से बाहर है। कीबोर्ड लिस्ट को Down Arrow से खोलता है।
  • मिटाने का बटन एक बटन है जिसका नाम clearLabel से आता है, और वह इनपुट के बाद फ़ोकस का अगला पड़ाव है।
  • Escape लिस्ट को बंद करती है और उससे आगे नहीं जाती, इसलिए कॉम्बोबॉक्स जिस डायलॉग में है, वह खुला रहता है।
  • फ़ील्ड का हिट एरिया न्यूनतम टार्गेट पूरा करता है, और विकल्प कम से कम न्यूनतम टार्गेट जितने ऊँचे हैं।
  • 200% टेक्स्ट पर लेबल, सहायता, विकल्प, शीर्षक और स्थिति पंक्ति रैप होते हैं। सिर्फ़ इनपुट का टेक्स्ट एक पंक्ति में रहता है, और स्क्रॉल होता है।
  • फ़ोर्स्ड कलर्स में फ़ील्ड और लिस्ट को एक किनारा मिलता है, सक्रिय विकल्प हाइलाइट के रंग लेता है, और चुना हुआ विकल्प अपने चेक के निशान से दिखाया जाता है।
  • दाएँ से बाएँ वाले लेआउट में फ़ील्ड और हर पंक्ति मिरर होती है, और हर टेक्स्ट अपनी दिशा बनाए रखता है। शेवरॉन, मिटाने के बटन का ग्लिफ़ और चेक का निशान मिरर नहीं होते।

वेब पर ज्ञात कमियाँ:

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

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

  • हर कॉम्बोबॉक्स फ़ील्ड को label दें, और हर विकल्प को एक लेबल और ऐसा मान जो ख़ाली न हो।
  • मिटाने के बटन वाले कॉम्बोबॉक्स फ़ील्ड को clearLabel दें।
  • statusText कॉम्बोबॉक्स फ़ील्ड पर लिखें। emptyText, requiredText, optionalText और clearLabel कॉम्बोबॉक्स फ़ील्ड पर दें, या setWords() से पूरे प्रॉडक्ट के लिए एक बार। Tanrei अपना कोई शब्द साथ नहीं देता; छूटे हुए शब्द की डेवलपमेंट में रिपोर्ट होती है। देखें प्रॉडक्ट के शब्द।
  • मान को ख़ुद वैलिडेट करें, error सेट करें, और errorText ऐसा लिखें कि वह बताए कि जवाब कैसे ठीक किया जाए।
  • एक कॉम्बोबॉक्स फ़ील्ड के भीतर विकल्पों के मान अलग-अलग रखें।