Skip to content

Patch floating labels #30

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 2 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
![Nodejs workflow status](https://github.com/mattzollinhofer/vue-typeahead-bootstrap/actions/workflows/nodejs.yml/badge.svg)

# Looking for Maintainer
Hey everyone, I haven't had the time to put into this project as I did in the past and I'm looking for a maintainer(s) to hand this off to. We've advanced the project substantially in terms of accessibility and some functionality and am looking for the next person to carry this forward. Contact me directly or open an issue if you're interested!

# vue-typeahead-bootstrap

A simple `list-group` based typeahead/autocomplete using Bootstrap 4 and Vue 2

<img src="https://raw.githubusercontent.com/mattzollinhofer/vue-typeahead-bootstrap/main/assets/screenshot.png" alt="Preview image of the vue-typeahead-bootstrap component">

Here are some live examples, [give them a try here.](https://mattzollinhofer.github.io/vue-typeahead-bootstrap-docs/examples/examples.html#custom-suggestion-slot)

## Getting Started
[Getting started guide is here.](https://mattzollinhofer.github.io/vue-typeahead-bootstrap-docs/guide/gettingStarted.html#installation)

## Documentation
[Docs are here.](https://mattzollinhofer.github.io/vue-typeahead-bootstrap-docs/)

## Contributing
Please note that active development is done on the `main` branch. PR's are welcome! Here's the basic steps to get going.

Here's the steps to getting the project to work locally:

1. Clone the repo: `git clone [email protected]:mattzollinhofer/vue-typeahead-bootstrap.git`
2. `npm ci`
3. `vuepress dev docs`
4. Open a browser and go to localhost:8080

* Then to run tests: `npm run test:unit`

## 2.0 Release - Migration Necessary
If you were using a version prior to 2.0, you'll need to change all references of `vue-bootstrap-typeahead` to `vue-typeahead-bootstrap` and of `VueBootstrapTypeahead` to `VueTypeaheadBootstrap`.

The original project lost it's maintainer and we picked it up to keep it moving. [More info here if you're interested.](https://github.com/alexurquhart/vue-bootstrap-typeahead/issues/60)

## Local Examples/Demo
Clone this repository and run `vuepress dev docs`. Then, navigate to http://localhost:8080/vue-typeahead-bootstrap-docs/ to launch the documentation and examples. The source is in `docs/README.md` and `docs/.vuepress`
# No Longer Maintained, Moved
This version of the project is no longer maintained. Graciously, [@drikusroor](https://github.com/drikusroor) has taken over development and maintenance at [this repository](https://github.com/drikusroor/vue-bootstrap-autocomplete) and it is published on [NPM here](https://www.npmjs.com/package/@vue-bootstrap-components/vue-bootstrap-autocomplete).

## Lineage
I want to specifically acknowledge the original repository by Alex Urquhart for this work: https://github.com/alexurquhart/vue-bootstrap-typeahead. He brought this project into reality, we're simply trying to help keep it moving forward. Thanks, Alex!
6 changes: 6 additions & 0 deletions src/components/VueTypeaheadBootstrap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@keydown.esc="handleEsc($event.target.value)"
@keyup="$emit('keyup', $event)"
/>
<slot name="label"></slot>
<div v-if="$slots.append || append" class="input-group-append">
<slot name="append">
<span class="input-group-text">{{ append }}</span>
Expand Down Expand Up @@ -133,6 +134,10 @@ export default {
type: String,
default: ''
},
inputGroupClass: {
type: String,
default: null
},
inputName: {
type: String,
default: undefined
Expand Down Expand Up @@ -178,6 +183,7 @@ export default {
return Math.floor(Math.random() * 100000)
},
inputGroupClasses() {
if(this.inputGroupClass) return this.inputGroupClass
return this.size ? `input-group input-group-${this.size}` : 'input-group'
Comment on lines +186 to 187
Copy link
Preview

Copilot AI Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When inputGroupClass is provided, the default 'input-group' styling is completely bypassed. Consider merging inputGroupClass with the default classes to avoid potential layout issues, especially with floating labels.

Suggested change
if(this.inputGroupClass) return this.inputGroupClass
return this.size ? `input-group input-group-${this.size}` : 'input-group'
const defaultClasses = this.size ? `input-group input-group-${this.size}` : 'input-group';
return this.inputGroupClass ? `${defaultClasses} ${this.inputGroupClass}` : defaultClasses;

Copilot uses AI. Check for mistakes.

},

Expand Down