In a local setting, the KendoUI chips are displaying without their borders

I recently tested out the code from kendo on StackBlitz and it worked perfectly:

https://i.stack.imgur.com/Nrp2A.png

However, when running the same code on my localhost, all the styling for the chip is missing:

https://i.stack.imgur.com/1pUH9.png

The chip appears as a block instead of styled properly, and I'm struggling to pinpoint the reason behind this issue. So far, I haven't been able to replicate the error on StackBlitz.

Here's what I've tried so far in terms of troubleshooting:

  • I stopped my localhost server and ran npm i; npm start again.
  • I checked the dependencies in both local and StackBlitz environments, and they match up in the package.json file.

https://i.stack.imgur.com/YqTKI.png

Below is the content of the component.ts file:


// Angular imports
import { Component,  ViewChild, ViewEncapsulation } from '@angular/core';
import { ChipRemoveEvent } from '@progress/kendo-angular-buttons';
import { AutoCompleteComponent } from '@progress/kendo-angular-dropdowns';

@Component({
  selector: 'sentryx-email-chips',
  templateUrl: './email-chips.component.html',
  encapsulation: ViewEncapsulation.None,
  styleUrls: ['./email-chips.component.scss']
})
export class EmailChipsComponent {
  @ViewChild("contactslist") public list: AutoCompleteComponent;

  public contacts: Array<{ label: string; iconClass: string }> = [
    { label: "Pedro Afonso", iconClass: "k-chip-avatar" },
    { label: "Maria Shore", iconClass: "k-chip-avatar" },
    { label: "Thomas Hardy", iconClass: "k-chip-avatar" },
    { label: "Christina Berg", iconClass: "k-chip-avatar" },
    { label: "Paula Wilson", iconClass: "k-chip-avatar" }
  ];

  public selectedContacts: Array<any> = [this.contacts[1]];

  public valueChange(contact: string): void {
    console.log(contact);
    if (contact === "") {
      return;
    }

    this.selectedContacts.push({
      label: contact,
      class: `custom-style`
    });

    // const contactData = this.contacts.find(c => c.label === contact);

    // if (!this.selectedContacts.includes(contactData)) {
    //   this.selectedContacts.push(contactData);
    // } else {
    //   this.selectedContacts.push({
    //     label: contact,
    //     iconClass: "k-chip-avatar paula"
    //   });
    // }

    this.list.reset();
  }

  public onRemove(e: ChipRemoveEvent): void {
    console.log("Remove event arguments: ", e);
    const index = this.selectedContacts
      .map(c => c.label)
      .indexOf(e.sender.label);
    this.selectedContacts.splice(index, 1);
  }

}

HTML section:

<kendo-chip *ngFor="let contact of selectedContacts" [class]="contact.class" [label]="contact.label" [removable]="true"
  [iconClass]="contact.iconClass" (remove)="onRemove($event)">
</kendo-chip>
<div class="example">
  <kendo-autocomplete #contactslist [data]="contacts" class="contacts" valueField="label"
    [kendoDropDownFilter]="{ operator: 'contains' }" [filterable]="true" placeholder="To: Email Address*" 
    (valueChange)="valueChange($event)">
  </kendo-autocomplete>
</div>

CSS:

.k-chip {
    margin-right: 10px;
  }
  .k-block {
    min-height: 300px;
    padding: 20px;
  }
  .k-textarea {
    width: 100%;
    min-height: 145px;
  }
  .contacts {
    border-width: 0 0 1px 0;
    width: 100%;
    margin: 30px 0;
  }
  .contacts.k-state-focused {
    box-shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.03);
  }

  .custom-style {
    color: #6200ee;
    background-color: #f3ebfe;
    border-color: #6200ee;
  }

UPDATE

Other kendo components seem to be working fine. For instance, the kendo dropdown above functions without any issues. I also tested the kendo button and found it to be working correctly as well:

<button kendoButton >Browse</button>

https://i.stack.imgur.com/fqLS1.png

Answer №1

The problem arose from the fact that the style sheets were being imported twice in the index.html file:

<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-default@latest/dist/all.css" />
<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-default@latest/dist/all.css"></link>

Despite importing kendo chips from the module, these styles were not appearing in the angular application.

To resolve this issue, I had to navigate to the style.css file for the app and include the following line:

@import "~@progress/kendo-theme-bootstrap/scss/chip";

In addition, I needed to access the progress package within the node_modules directory to check the chip functionality.

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

Div blur event for editing content

Utilizing a content editable div as an input control has presented some challenges for me. Unlike a textarea or input element, the div does not send information to the server automatically. To work around this issue, I have implemented a solution where I u ...

What is the best way to align inline-block elements in a straight row?

I am encountering an issue with the code block below: <div class="1"> Foo<br>1 </div> <div class="2"> Bar<br>2 </div> Even though both .1 and .2 have styles of position:relative;display:inline-block, they are displ ...

Initiate a click event on an anchor element with the reference of "a href"

I'm currently facing an issue with clicking a href element on my HTML website. The click event doesn't seem to be triggered. CODE: HTML CODE: <div class="button" id="info" ></div> <ul id="game-options"> <li><a ...

BehaviorSubject Observable continuously notifies unsubscribed Subscription

Utilizing a service called "settings", initial persisted values are read and provided through an observable named "settings$" to components that subscribe to it. Many components rely on this observable to retrieve the initial values and exchange updated va ...

What is the best way to protect old documents when selecting new files in a multi-file uploader?

I created a file upload feature with file previews using HTML5 and the file reader, which is functioning well. However, I'm facing an issue where old files selected by the user get removed from the input file field if a new file is selected in a singl ...

The act of employing `Function.prototype.run` within an Angular TypeScript class is deemed as illegitimate

Is there a way to globally define a new function called run within my Angular component as shown below? Function.prototype.run = function (delay: number) { // some content; }; However, the compiler shows an error that the Property 'run' does n ...

Placing two tables in an HTML document

I am working on integrating two tables into my web application and I would like them to be positioned on the same row horizontally. <span><table><tr><td>A</td><td>B</td></tr></table></span> <s ...

Remove any errors as soon as the input field becomes valid

My current setup involves AngularJS with node.js. To handle errors, I have devised the following strategy: node router effect.js: router.post('/', function(req, res, next){ req.checkBody('name', 'Eff ...

Issue encountered: NPM error, unable to find solution for resolving dependency and addressing conflicting peer dependency

I am facing difficulties deploying my project on netlify due to NPM errors. Below are the dependencies: "dependencies": { "@angular/animations": "~15.1.1", ... (list of dependencies continues) ...

I was able to use the formGroup without any issues before, but now I'm encountering an error

<div class="col-md-4"> <form [formGroup]="uploadForm" (ngSubmit)="onSubmit(uploadForm.organization)"> <fieldset class="form-group"> <label class="control-label" for="email"> <h6 class="text-s ...

Why does the <div> element still have an offset even though its width and height are set to 100px and padding, margin, and border are set to 0px?

After styling my div element with specific CSS rules, I'm encountering an issue. The div has a set width and height of 100px along with padding, border, and margin all set to 0px. However, the elements are not being offset from the edges of the browse ...

Leveraging Sessions in Angular with Spring Boot

As I try to implement a login and session management system for my library portal, I have developed backend services using Spring Boot and frontend with Angular. While exploring an example of Spring Boot + Session Management on this link: , I made some adj ...

Error TS2339: The 'phoneType' property cannot be found on the 'Object' data type

Below is the declaration of an object: export class Card { private _phones:Object[] get phones(): Object[]{ if(this._phones === undefined) this._phones = [] return this._phones } set phones(val:Object[]){ ...

Script for calculating in PHP

I've scoured the internet in search of a sample script that meets my specific needs, but unfortunately, I have come up empty-handed. Essentially, I am looking to retrieve a value from a div and then multiply that number based on user input. For instan ...

Utilizing JavaScript to eliminate objects from a collection and showcase a refreshed arrangement

On a simple webpage using bootstrap and js/jquery, data is fetched via ajax to create entries displayed to the viewer. The process involves: - making a request - parsing XML to create an array of objects with all the data - sorting by one property - cr ...

Verify whether the value is in the negative range and implement CSS styling in React JS

I have been developing a ReactJS website where I utilize Axios to fetch prices from an API. After successfully implementing this feature, I am now looking for a way to visually indicate if the 24-hour change percentage is positive by showing it in green, a ...

Using HTML to execute a JavaScript function that transforms images

The script cutImageUp has been previously discussed on SE in a thread about Shattering image using canvas. However, I have encountered a different issue while attempting to use it. The HTML code I implemented seems to be ineffective, and despite my efforts ...

Getting around relative paths in an Angular application hosted by NGINX

I am using NGINX to host my Angular application. The frontend is accessible at http://localhost/, and the backend can be accessed at http://localhost/api/. While most of my configuration works correctly, I am encountering an issue with a relative path in a ...

Can you remind me of the specific CSS class used for Internet Explorer in Twitter Bootstrap?

Currently utilizing Twitter Bootstrap and curious if there is a specific CSS class to designate IE browsers within the BODY or HTML tags. Interested in writing CSS specifically for all IE browsers. Aware that Bootstrap offers some CSS classes for IE brows ...

Remove the option to select specific minutes from the time input on an HTML

My HTML code includes a time input that looks like this: <input id="appt-time" type="time" name="appt-time" value="13:30" /> I want to figure out how I can remove the minutes from the input or ensure that the ...