Skip to content

Instantly share code, notes, and snippets.

@bhays
Created August 2, 2013 13:54
Show Gist options
  • Star 42 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save bhays/6140058 to your computer and use it in GitHub Desktop.
Save bhays/6140058 to your computer and use it in GitHub Desktop.
Bootstrap 3 style fixes for using Typeahead.js
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #999;
vertical-align: middle;
background-color: #ffffff;
border: 1px solid #cccccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
.tt-dropdown-menu {
min-width: 160px;
margin-top: 2px;
padding: 5px 0;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
}
.tt-suggestion {
display: block;
padding: 3px 20px;
}
.tt-suggestion.tt-is-under-cursor {
color: #fff;
background-color: #428bca;
}
.tt-suggestion.tt-is-under-cursor a {
color: #fff;
}
.tt-suggestion p {
margin: 0;
}
@joelhaasnoot
Copy link

Thanks @mkli90 - this is a usable version: https://gist.github.com/joelhaasnoot/c7f3358726c22d489566

@vander911
Copy link

Congrats! Very helpful...

@UmilaHeshan
Copy link

its working and thanks.if u want to get full size for text field try this # width: 100%;

.tt-dropdown-menu {
min-width: 160px;
margin-top: 2px;
padding: 5px 0;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.15);
cursor: pointer;
border-radius: 4px;
width: 100%;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;

    }

@AntMooreWebDev
Copy link

AntMooreWebDev commented Nov 29, 2017

Awesome work dude, I had to make some tweaks to get it to work with my version of typeahead (0.11.1) (credit to @kabal for initial pointers), and I created a fork here: https://gist.github.com/AntMooreWebDev/2f7e423a11bc74359323995df4494167.

I also amended the styling so that the suggested options span the width of the menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment