[FIXED] Dots instead lines in the carousel indicators – primeng

Issue

I am developing a carousel, but I want the indicators won’t be lines, I want the indicatos will be small dots. The answer is in the css files, but I dont know How I can work with this, I think I must create a css class but I dont sure, could you help me? I leave an image like references, the code I am using, and the documentation of the carousel I am using. Thanks in advance.

This is the image:

enter image description here

This is the code:

<p-carousel [value]="products" [numVisible]="3" [numScroll]="3" [circular]="false" [responsiveOptions]="responsiveOptions" class="I`m not sure if this declaration is OK">
    <ng-template pTemplate="header">
    </ng-template>
    <ng-template let-product pTemplate="item">
        <div class="product-item">
            <div class="product-item-content">
                <div class="p-mb-3">
                    <img src="assets/showcase/images/demo/product/{{product.image}}" [alt]="product.name" class="product-image" />
                </div>
                <div>
                    <h4 class="p-mb-1">{{product.name}}</h4>
                    <h6 class="p-mt-0 p-mb-3">${{product.price}}</h6>
                    <span [class]="'product-badge status-'+product.inventoryStatus.toLowerCase()">{{product.inventoryStatus}}</span>
                    <div class="car-buttons p-mt-5">
                        <p-button type="button" styleClass="p-button p-button-rounded p-mr-2" icon="pi pi-search"></p-button>
                        <p-button type="button" styleClass="p-button-success p-button-rounded p-mr-2" icon="pi pi-star"></p-button>
                        <p-button type="button" styleClass="p-button-help p-button-rounded" icon="pi pi-cog"></p-button>
                    </div>
                </div>
            </div>
        </div>
    </ng-template>
</p-carousel>

Documentation:
https://www.primefaces.org/primeng/showcase/#/carousel

Solution

look for theme file:

https://github.com/primefaces/primeng/blob/master/src/assets/components/themes/saga-blue/theme.css

In that file there is a rule .p-carousel .p-carousel-indicators .p-carousel-indicator button , on line no. ~2235, change it to:

.p-carousel .p-carousel-indicators .p-carousel-indicator button {
    background-color: #e9ecef;
    width: 1rem;
    height: 1rem;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
    border-radius: 50%;
}

Note: there are many themes available change all or the one you are using. https://github.com/primefaces/primeng/tree/master/src/assets/components/themes

Results will look like this:

enter image description here

Answered By – the Hutt

Answer Checked By – Cary Denson (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published