klewis
klewis

Reputation: 8359

How to reference sass styles of is-invalid onto a custom class?

Within Bootstrap, there is a class we can use called is-invalid. I'm using a separate validation tool that adds the class input-validation-error onto my elements where the issue is invalid. I cannot change that name. Nor do I want to duplicate styling that is-invalid already provides.

Is there a way from SASS, that I can borrow the mixin or color schemes of is-invalid and apply them to my custom class called input-validation-error?

Upvotes: 1

Views: 516

Answers (1)

Carol Skelly
Carol Skelly

Reputation: 362710

Sure, you can simply use @extend...

.input-validation-error {
   @extend .is-invalid;
}

Demo: https://www.codeply.com/go/IBJbBsznKP


Related: How to extend existing SASS bootstrap grid classes

Upvotes: 3

Related Questions