2019-11-12 14:07:42 +03:00
---
title: Autocomplete
path: components/autocomplete
status: Stable
source: 'https://github.com/primer/css/tree/master/src/autocomplete'
bundle: autocomplete
---
## Autocomplete
A list of items used to show autocompleted results. Use the [`<auto-complete>` ](https://github.com/github/auto-complete-element ) element to add functionality.
```html live
< div class = "position-relative" >
< input class = "form-control input-block" type = "text" aria-label = "Search" placeholder = "Search" >
< ul class = "autocomplete-results" >
< li class = "autocomplete-item" aria-selected = "true" > Option 1< / li >
< li class = "autocomplete-item" > Option 2< / li >
< li class = "autocomplete-item" > Option 3< / li >
< / ul >
< / div >
< style > . frame-example { width : 300 px ; height : 160 px ; } < / style >
```
2020-08-25 07:10:41 +03:00
Autocomplete items can contain additional content, like an `.avatar` . Or use utility classes to customize the text style.
2019-11-12 14:07:42 +03:00
```html live
< div class = "position-relative" >
< input class = "form-control input-block" type = "text" aria-label = "Search by user" placeholder = "Search by user" >
< ul class = "autocomplete-results" >
< li class = "autocomplete-item" aria-selected = "true" >
< img src = "https://github.com/github.png" width = "20" class = "avatar mr-1" alt = "" >
< span > GitHub Inc.< / span >
< span class = "text-normal" > @github< / span >
< / li >
< li class = "autocomplete-item" >
< img src = "https://github.com/hubot.png" width = "20" class = "avatar mr-1" alt = "" >
< span > Hubot< / span >
< span class = "text-normal" > @hubot< / span >
< / li >
< li class = "autocomplete-item" >
< img src = "https://github.com/octocat.png" width = "20" class = "avatar mr-1" alt = "" >
< span > Monalisa Octocat< / span >
< span class = "text-normal" > @octocat< / span >
< / li >
< / ul >
< / div >
< style > . frame-example { width : 300 px ; height : 160 px ; } < / style >
```
## Suggester
The `.suggester` component is meant for showing suggestions while typing in a larger text area. Use the [`<text-expander>` ](https://github.com/github/text-expander-element ) element to add functionality.
```html live
< div class = "form-group position-relative" >
2019-11-15 10:14:04 +03:00
< textarea class = "form-control width-full" placeholder = "Leave a comment" aria-label = "Comment body" > This is on top of #< / textarea >
< ul class = "suggester suggester-container" role = "listbox" style = "top: 4px; left: 125px;" >
2019-11-12 14:07:42 +03:00
< li aria-selected = "true" > < small > #924< / small > < span > Markdown tables are inaccessible< / span > < / li >
< li > < small > #980< / small > < span > Use actual book emoji in Flexbox docs< / span > < / li >
< li > < small > #979</ small > < span > Add `.radio-group` component</ span > </ li >
< li > < small > #925< / small > < span > Release 14.0.0< / span > < / li >
< li > < small > #978</ small > < span > Add `.css-truncate-overflow` </ span > </ li >
< / ul >
< / div >
< style > . frame-example { height : 260 px ; } < / style >
```