Skip to content

Commit b02bae7

Browse files
mdoXhmikosR
authored andcommitted
Document example of datalists with form controls (twbs#29058)
- Add example to the new form control docs - Reset the [list] selector in Reboot to hide the random dropdown arrow in Chrome
1 parent 1a9b120 commit b02bae7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

scss/_reboot.scss

+7
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ select {
407407
word-wrap: normal;
408408
}
409409

410+
// Remove the dropdown arrow in Chrome from inputs built with datalists.
411+
//
412+
// Source: https://stackoverflow.com/a/54997118
413+
414+
[list]::-webkit-calendar-picker-indicator {
415+
display: none;
416+
}
410417

411418
// 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
412419
// controls in Android 4.

site/content/docs/4.3/forms/form-control.md

+20
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,23 @@ Keep in mind color inputs are [not supported in IE](https://caniuse.com/#feat=in
8484
<input type="color" class="form-control form-control-color" id="exampleColorInput" value="#563d7c" title="Choose your color">
8585
</form>
8686
{{< /example >}}
87+
88+
## Datalists
89+
90+
Datalists allow you to create a group of `<option>`s that can be accessed (and autocompleted) from within an `<input>`. These are similar to `<select>` elements, but come with more menu styling limitations and differences. While most browsers and operating systems include some support for `<datalist>` elements, their styling is inconsistent at best.
91+
92+
Learn more about [support for datalist elements](https://caniuse.com/#feat=datalist).
93+
94+
{{< example >}}
95+
<form>
96+
<label for="exampleDataList">Datalist example</label>
97+
<input class="form-control" list="datalistOptions" id="exampleDataList" placeholder="Type to search...">
98+
<datalist id="datalistOptions">
99+
<option value="San Francisco">
100+
<option value="New York">
101+
<option value="Seattle">
102+
<option value="Los Angeles">
103+
<option value="Chicago">
104+
</datalist>
105+
</form>
106+
{{< /example >}}

0 commit comments

Comments
 (0)