Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Check for multiple routes using 'in' class

I am using shoelace library buttons on my menu bar and below is my code to highlight a specific menu when selected:

<sl-button
                    slot="trigger"
                    variant="text"
                    size="large"
                    caret
                    class=${classMap({
                        'nav-button': true,
                        current__route: this.route === '/mysite/root/',
                        nav__open: this.about,
                    })}
                    ><a class="link" href="/mysite/root/">About</a></sl-button>
<sl-menu>
                    <sl-menu-item value="/mysite/root/firstpage/"
                        ><a href="/mysite/root/firstpage/"
                            >First Page</a
                        ></sl-menu-item
                    >
                    <sl-menu-item value="/mysite/root/secondpage/">
                        <a href="/mysite/root/secondpage/"
                            >Second Page</a
                        >
                    </sl-menu-item>
</sl-menu>

According to the code above, when I click on the "About" menu the class is assigned. However, I would like to highlight the "About" menu when "First Page" or "Second Page" menu items are clicked. for that I have to compare the URL routes at:

current__route: this.route === '/mysite/root/' 

Can someone guide on how to use wildcard to search for URL or using 'in' class to check for multiple URL routes? I tried the below option and it didn't work:

current__route: this.route in ['/mysite/root/','/mysite/root/firstpage/','/mysite/root/secondpage/']

any help?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!