Skip to content
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

Typeahead should add 'is-valid' and 'is-invalid' classes to its wrapper div when validating #778

Closed
tophboogie opened this issue Mar 26, 2023 · 2 comments

Comments

@tophboogie
Copy link

tophboogie commented Mar 26, 2023

Hi,
First off thanks for writing a great piece of software :)

When passing the isValid or isInvalid props to Typeahead, it would be great if it added the bootstrap classes 'is-valid' or 'is-invalid' to the typeahead wrapper div. This way, Form.Control.Feedback components would hide and display automatically when validating the form. Unless I am missing something, right now they need to be manually managed.

I looked into the Bootstrap 5 CSS and the feedback visibility is managed by

.is-invalid~.invalid-feedback { display: block; }

So for now I am manually adding these classes to the wrapper div in order to show the feedback, like so:

<Form.Group>
<Typeahead ... isInvalid={isTypeaheadInvalid} className={isTypeaheadInvalid ? 'is-invalid' : ''}  />
<Form.Control.Feedback type='invalid'>No {displayName} Selected!</Form.Control.Feedback>
</Form.Group>

This is working well but it seems like something that the component should just do on its own. Thanks!

@ericgio
Copy link
Owner

ericgio commented Mar 28, 2023

Hey @tophboogie, thanks for the feature request. Added in v6.1.0

@ericgio ericgio closed this as completed Mar 28, 2023
@tophboogie
Copy link
Author

Awesome, thanks!

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

No branches or pull requests

2 participants