|
36 | 36 | aria-label="Combobox demo" |
37 | 37 | aria-owns="listbox-1" |
38 | 38 | > |
39 | | - <svg |
40 | | - class="icon icon--12" |
41 | | - height="8" |
42 | | - width="8" |
43 | | - aria-hidden="true" |
44 | | - > |
45 | | - <icon-symbol name="chevron-down-12"/> |
46 | | - </svg> |
47 | 39 | </span> |
48 | 40 | <div class="combobox__listbox"> |
49 | 41 | <div |
|
73 | 65 | <span class="combobox"> |
74 | 66 | <span class="combobox__control"> |
75 | 67 | <input placeholder="Combobox" role="combobox" type="text" aria-haspopup="listbox" aria-owns="listbox-1" /> |
76 | | - <svg class="icon icon--12" height="8" width="8" aria-hidden="true"> |
77 | | - <use href="#icon-chevron-down-12"></use> |
78 | | - </svg> |
79 | 68 | </span> |
80 | 69 | <div class="combobox__listbox"> |
81 | 70 | <div id="listbox-1" class="combobox__options" role="listbox"> |
|
119 | 108 | aria-owns="listbox-2" |
120 | 109 | disabled |
121 | 110 | > |
122 | | - <svg |
123 | | - class="icon icon--12" |
124 | | - height="8" |
125 | | - width="8" |
126 | | - aria-hidden="true" |
127 | | - > |
128 | | - <icon-symbol name="chevron-down-12"/> |
129 | | - </svg> |
130 | 111 | </span> |
131 | 112 | <div class="combobox__listbox"> |
132 | 113 | <div |
|
156 | 137 | <span class="combobox"> |
157 | 138 | <span class="combobox__control"> |
158 | 139 | <input placeholder="Combobox" role="combobox" type="text" aria-haspopup="listbox" aria-owns="listbox-2" disabled /> |
159 | | - <svg class="icon icon--12" height="8" width="8" aria-hidden="true"> |
160 | | - <use href="#icon-chevron-down-12"></use> |
161 | | - </svg> |
162 | 140 | </span> |
163 | 141 | <div class="combobox__listbox"> |
164 | 142 | <div id="listbox-2" class="combobox__options" role="listbox"> |
|
175 | 153 | </div> |
176 | 154 | </span> |
177 | 155 | </highlight-code> |
178 | | - <!-- |
179 | | - <h3 id="combobox-readonly">Readonly Combobox</h3> |
180 | | - <p>A readonly combobox is intended for use as a custom implementation of the native HTML select element. Unlike the default combobox, its options <em>do</em> have state. Notice that an additional span element is required within each option to host the status icon.</p> |
181 | | - <p>Unfortunately, a readonly combobox exhibits some UX issues on iOS, which is why for now we recommend using the <a href="#listbox">listbox</a> instead.</p> |
182 | | - <p>Apply the <span class="highlight">combobox--readonly</span> modifier and <span class="highlight">readonly</span> input property to create a readonly combobox.</p> |
183 | | - <p>By default, the textbox value should match the first option if the user does not specify a selection. This matches the behaviour of a native HTML select element.</p> |
184 | | -
|
185 | | - <div class="demo"> |
186 | | - <div class="demo__inner"> |
187 | | - <form action="index.html"> |
188 | | - <span class="combobox combobox--readonly"> |
189 | | - <span class="combobox__control"> |
190 | | - <input name="combobox-readonly" role="combobox" type="text" value="Option 1" aria-haspopup="listbox" aria-label="Combobox demo" aria-owns="listbox4" readonly /> |
191 | | - <svg class="icon icon--12" height="8" width="8" aria-hidden="true"> |
192 | | - <icon-symbol name="chevron-down-12" /> |
193 | | - </svg> |
194 | | - </span> |
195 | | - <div class="combobox__listbox"> |
196 | | - <div id="listbox4" class="combobox__options" role="listbox"> |
197 | | - <div class="combobox__option" role="option"> |
198 | | - <span class="combobox__value">Option 1</span> |
199 | | - <svg class="icon icon--16" height="8" width="8"> |
200 | | - <icon-symbol name="tick-16" /> |
201 | | - </svg> |
202 | | - </div> |
203 | | - <div class="combobox__option" role="option"> |
204 | | - <span class="combobox__value">Option 2</span> |
205 | | - <svg class="icon icon--16" height="8" width="8"> |
206 | | - <icon-symbol name="tick-16" /> |
207 | | - </svg> |
208 | | - </div> |
209 | | - <div class="combobox__option" role="option"> |
210 | | - <span class="combobox__value">Option 3</span> |
211 | | - <svg class="icon icon--16" height="8" width="8"> |
212 | | - <icon-symbol name="tick-16" /> |
213 | | - </svg> |
214 | | - </div> |
215 | | - </div> |
216 | | - </div> |
217 | | - </span> |
218 | | - </form> |
219 | | - </div> |
220 | | - </div> |
221 | | -
|
222 | | - <highlight-code type="html" > |
223 | | -<span class="combobox combobox--readonly"> |
224 | | - <span class="combobox__control"> |
225 | | - <input role="combobox" type="text" value="Option 1" aria-haspopup="listbox" aria-owns="listbox4" readonly /> |
226 | | - <svg class="icon icon--12" height="8" width="8" aria-hidden="true"> |
227 | | - <use href="#icon-chevron-down-12"></use> |
228 | | - </svg> |
229 | | - </span> |
230 | | - <div class="combobox__listbox"> |
231 | | - <div id="listbox4" class="combobox__options" role="listbox"> |
232 | | - <div class="combobox__option" role="option"> |
233 | | - <span class="combobox__value">Option 1</span> |
234 | | - <svg class="icon icon--16" height="8" width="8"> |
235 | | - <use href="#icon-tick-16"></use> |
236 | | - </svg> |
237 | | - </div> |
238 | | - <div class="combobox__option" role="option"> |
239 | | - <span class="combobox__value">Option 2</span> |
240 | | - <svg class="icon icon--16" height="8" width="8"> |
241 | | - <use href="#icon-tick-16"></use> |
242 | | - </svg> |
243 | | - </div> |
244 | | - <div class="combobox__option" role="option"> |
245 | | - <span class="combobox__value">Option 3</span> |
246 | | - <svg class="icon icon--16" height="8" width="8"> |
247 | | - <use href="#icon-tick-16"></use> |
248 | | - </svg> |
249 | | - </div> |
250 | | - </div> |
251 | | - </div> |
252 | | -</span> |
253 | | - </highlight-code> |
254 | | -
|
255 | | - <h3 id="combobox-button">Icon Button Combobox</h3> |
256 | | - <p>In some cases, the suggestion overlay might be controlled by an <a href="#icon-button">icon button</a>. Use an <span class="highlight">icon-btn</span> and the <span class="highlight">combobox__control--actionable</span> modifier.</p> |
257 | | -
|
258 | | - <div class="demo"> |
259 | | - <div class="demo__inner"> |
260 | | - <form action="index.html"> |
261 | | - <span class="combobox"> |
262 | | - <span class="combobox__control combobox__control--actionable"> |
263 | | - <input name="combobox-default" placeholder="Combobox" role="combobox" type="text" aria-haspopup="listbox" aria-label="Combobox demo" aria-owns="listbox5" /> |
264 | | - <button class="icon-btn" type="button" aria-label="Expand Suggestions"> |
265 | | - <svg class="icon icon--12" height="8" width="8" aria-hidden="true"> |
266 | | - <icon-symbol name="chevron-down-12" /> |
267 | | - </svg> |
268 | | - </button> |
269 | | - </span> |
270 | | - <div class="combobox__listbox"> |
271 | | - <div id="listbox5" class="combobox__options" role="listbox"> |
272 | | - <div class="combobox__option" role="option"> |
273 | | - <span>Option 1</span> |
274 | | - </div> |
275 | | - <div class="combobox__option" role="option"> |
276 | | - <span>Option 2</span> |
277 | | - </div> |
278 | | - <div class="combobox__option" role="option"> |
279 | | - <span>Option 3</span> |
280 | | - </div> |
281 | | - </div> |
282 | | - </div> |
283 | | - </span> |
284 | | - </form> |
285 | | - </div> |
286 | | - </div> |
287 | | -
|
288 | | - <highlight-code type="html" > |
289 | | -<span class="combobox"> |
290 | | - <span class="combobox__control combobox__control--actionable"> |
291 | | - <input placeholder="Combobox" role="combobox" type="text" aria-haspopup="listbox" aria-owns="listbox5" /> |
292 | | - <button class="icon-btn" type="button" aria-label="Expand Suggestions"> |
293 | | - <svg class="icon icon--12" height="8" width="8" aria-hidden="true"> |
294 | | - <use href="#icon-chevron-down-12"></use> |
295 | | - </svg> |
296 | | - </button> |
297 | | - </span> |
298 | | - <div class="combobox__listbox"> |
299 | | - <div id="listbox5" class="combobox__options" role="listbox"> |
300 | | - <div class="combobox__option" role="option"> |
301 | | - <span>Option 1</span> |
302 | | - </div> |
303 | | - <div class="combobox__option" role="option"> |
304 | | - <span>Option 2</span> |
305 | | - </div> |
306 | | - <div class="combobox__option" role="option"> |
307 | | - <span>Option 3</span> |
308 | | - </div> |
309 | | - </div> |
310 | | - </div> |
311 | | -</span> |
312 | | - </highlight-code> |
313 | | -
|
314 | | - --> |
315 | 156 | </div> |
316 | 157 | export const metadata = { |
317 | 158 | component: "combobox", |
|
0 commit comments