My intention is to personalize the react-select component to suit my needs

My task involves changing the size of the arrow to be smaller and positioning it under the circle. Despite setting the width and height in the CSS, the desired effect is not achieved. To align with the UI requirements, I need to adjust the swiper-button-next and swiper-button-prev sizes accordingly.

 <Select
                      className="drop-down"
                      options={data?.map((data, index) => ({
                        value: data.username,
                        label: data.username,
                        id: index,
                      }))}
                      name="user"
                      value={data.username}
                      onChange={handleSelectChangeL}
                      placeholder="User Name"
                      theme={(theme) => ({
                        ...theme,
                        colors: {
                          ...theme.colors,
                          text: "black",
                          primary25: "#d6fdf7",
                          primary: "#0bb7a7",
                          primary50: "#d6fdf7",
                        },
                      })}
                    ></Select>

                    <button
                        className="dash-button-1"
                        type="submit"
                        variant="contained"
                        onClick={reset}
                      >
                        Reset
                      </button>

Answer №1

To adjust the size of the swiper arrow icons, you can simply modify the font size using the following CSS code:

.mySwiper .swiper-button-next:after, .mySwiper .swiper-button-prev:after {
    font-size: 15px;
}

Answer №2

Adjust the font size for the before and after buttons to ensure proper visibility.

.swiper-button-next:after, .swiper-button-prev:after {
  font-size: 10px;
}

See the code snippet below for a working example:

var mySwiper = new Swiper(".carousel", {
  navigation: {
    nextEl: ".swiper-button-next",
    prevEl: ".swiper-button-prev"
  }
});
body {
  position: relative;
  height: 100%;
}

body {
  background: #eee;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #000;
  margin: 0;
  padding: 0;
}

.carousel {
  width: 100%;
  height: 100%;
}

.slide {
  text-align: center;
  font-size: 18px;
  background: #fff;

  display: flex;
  justify-content: center;
  align-items: center;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.swiper-button-prev {
  color: red;
  width: 2%;
  height: 2%;
}

.swiper-button-next {
  color: #000;
  width: 2%;
  height: 2%;
}

.carousel .swiper-button-next:after, .carousel .swiper-button-prev:after {
  font-size: 10px;
}
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />

<div class="carousel">
  <div class="slides">
    <div class="slide">Slide 1</div>
    <div class="slide">Slide 2</div>
    <div class="slide">Slide 3</div>
    <div class="slide">Slide 4</div>
    <div class="slide">Slide 5</div>
    <div class="slide">Slide 6</div>
    <div class="slide">Slide 7</div>
    <div class="slide">Slide 8</div>
    <div class="slide">Slide 9</div>
  </div>
  <div class="swiper-button-next"></div>
  <div class="swiper-button-prev"></div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

"Exploring the world of skyrocketing data reads with Firestore integration in Next.js

I set up a page to display a collection of data and automatically update a document whenever changes are made. However, I noticed a significant increase in my read counts - over 2k reads for only 250 docs even after opening the page just three times. Ideal ...

Receiving JSON information rather than frontend markup code

My express backend organizes its routers in the following order: 1. All the API routes (e.g. /notes) 2. The catch-all route that serves all frontend code from the React build folder. On the client side, I use React Router with routes named differently ...

Using Selenium to locate and click on a hyperlink within a table by identifying it with its displayed name

In my case, I have a table that displays records of school districts. My goal is to use Selenium in order to select the delete icon positioned in the eighth td for the district located on a row with a specific name. In this scenario, the name being QA__run ...

Pausing the audio playback with a click of the mouse

As a beginner in front end development, I recently designed a simple website incorporating the Lightbox kit. One functionality I am currently working on is starting an audio track when a user clicks on a thumbnail image. However, I am seeking guidance on h ...

Material-UI chart displays only loading lines upon hovering

Currently, I am utilizing a Material UI Line chart in my NextJS 14 application to showcase some data. Although the data is being displayed properly, I have encountered an issue where the lines on the chart only render when hovered over, rather than appeari ...

Django No Reverse Match Error - All Functions Are Failing

After spending countless hours troubleshooting, I have encountered an issue where the HTML form action in a newly rendered page is causing the page not to load properly. Surprisingly, this specific line of code seems unrelated to the rendering process itse ...

What is the best way to prevent caching of pages that are using a local JSON file in Next.js static generation?

After deploying my Next.js app as static on my cPanel traditional hosting, I encountered an issue. Some pages are consuming a local JSON file that I fetch using getStaticProps, with the "revalidate" option set. However, when I make edits to the JSON file ...

Error 403 occurs after submitting the form

Recently, I encountered a 403 error when attempting to submit the form on this page. Interestingly, when I directly accessed the new page by typing the URL into my browser, it loaded without any issues. The PHP code in the initial page looks like this: & ...

Please tap to dial: Access to navigation is restricted

Trying to add a click-to-call link with the following code: <a href="tel:+4912345678912">Tel: +4912345678912</a> Despite Google developers saying it should work, major mobile browsers are blocking the navigation when clicking on the link. It ...

Is there a potential bug in Chrome with the submit button appearing "depressed" when focused?

Why do submit buttons act differently in Chrome? <input type='text' placeholder='Dummy Input'/> <input type='submit'/> In Chrome, the active 'depressed' state of the submit button will only occur if the ...

Ensuring the height of the HTML element for menu items matches the navigation bar

I've been struggling to customize a navigation bar styled with Bootstrap 4. My goal is to create a hover effect on the menu items similar to the image or code snippet provided, but without that annoying thin blue flashing offset below the item. Despit ...

The table is unable to properly display the array data

My code includes an AJAX function that sends a GET request to an API and receives data in the format shown below: { "firstname": "John", "lastname": "Doe", "email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6 ...

The parser for PHP CSS struggles with interpreting semicolons within property values

I encountered an issue while using a function to parse CSS files. The problem arises when the property values contain semicolons, causing it to break. Here's an example snippet from the CSS file: #logo { background-image: url("data:image/png;base ...

Generate a Vue component that automatically wraps text dynamically

Challenge I am looking for a way to dynamically wrap selected plain text in a Vue component using the mouseUp event. For instance: <div> Hello World! </div> => <div> <Greeting/> World! </div> Potential Solution Approach ...

Spacing between Div tags

Struggling with a tricky HTML cross-browser problem. The site was built by multiple people, making it quite messy, but needs to go live as soon as possible! Each of the 4 page layouts on the site are different and handled by separate classes. However, whe ...

How to align a Bootstrap form to the center

Struggling to center the opt-in form on my website, I've created a "center" class with margin properties but it's not working as expected. .center { margin-left: auto; margin-right: auto; width: 100% } I suspect that one of Bootstrap's cla ...

Designing a personalized look for a property with Styled-System

Styled-System offers various props related to css grid: I have a suggestion for a new prop, gridWrap. My idea is to allow users to adjust the auto-fit value using the gridWrap prop. Here's the base CSS code: grid-template-columns: repeat(auto-fit, mi ...

Expanding a wrapper to fit the entire width of its content

I am facing an issue where the background color of a wrapper does not adjust to the overflowing content within it. How can I make sure that the background stretches behind all the content, regardless of its size? <div style="background-color: black;m ...

Is there a way to automatically override the CSS cursor style?

Issue with SCSS styling on image link I attempted to modify the cursor style from pointer to default, but after saving and reloading my React app, the change did not take effect. I tried writing some code, but it seems that Stack Overflow is indicating an ...

How to display an image in a pop-up with a title

I am currently using the Bootstrap framework and I am trying to create a popup image with a title, but it only shows the image. I am not sure how to add code in JavaScript to display the title as well. Can someone please assist me? Here is my code: Javas ...