New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom selected item and highlighted text classes #184
Conversation
An example use-case of this is being able to use the default bootstrap classes without needing to include the autoComplete CSS or define separate
|
Hello @jerrykan, Thanks man for this PR I love it actually. But we need to take a collective decision on which direction for implementing those new APIs would make more sense: 1- Feature grouping: highlight: {
render: true,
className: "fw-bolder",
},
resultsList: {
render: true,
container: (source) => {},
className: "bg-light",
},
selection: {
className: "bg-light",
}, 2- Topic grouping: highlight: true,
resultsList: {
render: true,
container: (source) => {},
}
classes: {
highlighted: "fw-bolder",
selected: "bg-light",
resultsList: "dropdown-menu show",
reslutItem: "dropdown-item",
}, 3- You're most welcome if you have more ideas.. }
?
} Noting that the second approach would incur a complete redesign for the API configurations. (I'm totally okay with that if it's broken already) Let me know your thoughts. Cheers, and have a nice day! :) |
Hello @TarekRaafat personally I think the feature grouping option is the one that seems the most intuitive. |
@jerrykan, I agree with you. |
Allow users better control over how the selected item and highlighted text is displayed by letting them use their own custom classes instead of the ones hard-coded in the source code.
@TarekRaafat I've pushed a commit with the suggested changes. Unfortunately I couldn't find a nice way to provide backwards compatibility for the use of the You may also want to check the formatting of the changes I made to the |
Do you have an example of a full integration with Bootstrap 5 or 4? |
Thanks a lot for the example, I am already implementing it. I have a question about it: Once the dropdown is shown, the content below it is pushed down (happens to me too). I see that is not the case in this other demo you have shared before https://tarekraafat.github.io/autoComplete.js/demo/ Why is the content pushed down in the bootstrap 5 demo? |
You can easily fix that behavior by adding I have updated the example with this fix as well to make it easier for you. There could be a better solution using bootstrap but unfortunately, I don't have enough experience with it. |
Allow users better control over how the selected item and highlighted text is displayed by letting them use their own custom classes instead of the ones hard-coded in the source code.