Getting rid of the material input style on an Angular material chip

I have integrated material chips for multi-select functionality within a form of mine.

  <mat-form-field class="example-chip-list">
   <mat-chip-list #chipList>
    <mat-chip *ngFor="let fruit of fruits;let indx=index;" [selectable]="selectable" [removable]="removable" (removed)="remove(fruit,indx)">
         {{fruit.name}}
      <mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
    </mat-chip>
    <input placeholder="Enter business categories" #fruitInput [formControl]="fruitCtrl" [matAutocomplete]="auto" [matChipInputFor]="chipList" [matChipInputSeparatorKeyCodes]="separatorKeysCodes" [matChipInputAddOnBlur]="addOnBlur">
   </mat-chip-list>
   <mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)">
     <mat-option *ngFor="let fruit of filteredFruits | async" [value]="fruit">
         {{fruit.name}}
     </mat-option>
   </mat-autocomplete>
  </mat-form-field>

The issue I am encountering is with the styling of the material input field.

https://i.sstatic.net/R9NCw.png

This material input field is disrupting the overall look and feel of the form. How can I implement a custom input field instead of the material input?

Answer №1

The attribute appearance in mat-form-field can be customized

Try this out:

<mat-form-field class="custom-input-style" appearance="outlined">

To remove the underline, apply the following CSS:

::ng-deep .mat-form-field-underline {
  text-decoration: none;
}

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

Set a timeout for a single asynchronous request

Is there a way to implement a setTimeout for only one asynchronous call? I need to set a timeout before calling the GetData function from the dataservice, but it should be specific to only one asynchronous call. Any suggestions? Thank you. #html code < ...

I'm puzzled by how my observable seems to be activating on its own without

Sorry if this is a silly question. I am looking at the following code snippet: ngOnInit(): void { let data$ = new Observable((observer: Observer<string>) => { observer.next('message 1'); }); data$.subscribe( ...

Formik's handleChange function is causing an error stating "TypeError: null is not an object (evaluating '_a.type')" specifically when used in conjunction with the onChange event in DateInput

When using the handleChange function from Formik with the DateInput component in "semantic-ui-calendar-react", I encountered an error upon selecting a date. https://i.stack.imgur.com/l56hP.jpg shows the console output related to the error. AddWishlistFor ...

Ensure that the Angular target's getAttribute() method is validated for a

I encountered an issue with Angular while attempting to assign different values based on certain conditions. See the code snippet below: console.log("JJJJJJJ " + target.getAttribute("timingId")); console.log("KKKKKKKKK &qu ...

An unexpected error occurred in the Angular unit and integration tests, throwing off the script

I seem to be facing a recurring issue while running unit/integration tests for my Angular project using Karma. The tests have a 50:50 success/failure rate, working fine on my machine but failing consistently on our build server, making the process quite un ...

Error TS2304: Unable to locate identifier 'RTCErrorEvent'

I am currently working on a WebRTC application using Quasar, typescript and Vue. In my code snippet below, I am encountering an issue where I don't get any errors in WebStorm (as it uses the project's eslint config), and I can navigate to the def ...

How can you resolve the error message "No overload matches this call." while implementing passport.serializeUser()?

Currently, I am working on implementing passport.serializeUser using TypeScript. passport.serializeUser((user: User, done) => { done(null, user.id) }); The issue I am encountering is as follows: No overload matches this call. Overload 1 of 2, &ap ...

The issue with the AngularJS component layout engine is that the fxLayoutAlign attribute set to "stretch" is not

It seems that when using the angular/flex-layout along with angular/material2, the fxLayoutAlign="stretch" directive is not functioning correctly. However, the directives fxLayoutAlign="start" and fxLayoutAlign="end" are working as expected. You can see th ...

Having difficulty establishing the state interface and forwarding props to other components in React using TypeScript

I recently started using TypeScript and I'm working on a weather app utilizing the Open Weather API. I'm fetching data from the API, setting the state with the API response (weatherData), but I'm encountering an error in TypeScript when tryi ...

I am experiencing an issue with my Angular application where it appears blank on gh-pages and is unable to load JavaScript from Travis

After uploading an Angular app with Travis on Github pages using the gh-pages branch, I'm encountering a frustrating issue. The page is blank and there are several error messages in the console: Failed to load resource: https://hdz.github.io/runtime.j ...

The primary HTML file in Angular is unable to access the styles.scss file located in the src/styles directory

Just starting out with Angular. To incorporate the 7-1 scss pattern into my project, I established a styles folder within the src directory named "src/styles", and connected the components to the src/styles/style.scss file successfully. However, I'm ...

expand the module's children routes by including additional options from another module

Imagine we have a module called "Parent" which has some child routes: const routes: Routes = [ { path: '', component: ParentComponent, children: [ { path: '/:id', ...

Error: Jest + Typescript does not recognize the "describe" function

When setting up Jest with ts-jest, I encountered the error "ReferenceError: describe is not defined" during runtime. Check out this minimal example for more information: https://github.com/PFight/jest-ts-describe-not-defined-problem I'm not sure what ...

Show variously colored information for each selection from the dropdown using Angular Material

I am trying to change the color of displayed content based on user selection in an Angular application. Specifically, when a user chooses an option from a dropdown list, I want the displayed text to reflect their choice by changing colors. For example, i ...

Leveraging Jasmine-DOM for Angular Applications

I've been working on an Angular 10 CLI project (v10.1.2) and recently installed @testing-library/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="01606f66746d60734130312f312f33">[email protected]</a>. I'm ...

The use of the || operator within arguments

I am facing a challenge: //this console log displays correct value console.log('localstorage', localStorage.getItem('subMenu')); setSubMenu( JSON.parse(localStorage.getItem('subMenu') || JSON.stringify(s ...

What is the process for exporting a plugin from dayjs() in JavaScript?

Currently, I have incorporated the plugin isToday() to enhance the capabilities of dayjs(). Nevertheless, I am uncertain about how to export isToday() in order to utilize it across other files. import isToday from "dayjs/plugin/isToday"; expor ...

The absence of transpiled Typescript code "*.js" in imports

Here is an example of the code I am working with: User.ts ... import { UserFavoriteRoom } from "./UserFavoriteRoom.js"; import { Room } from "./Room.js"; import { Reservation } from "./Reservation.js"; import { Message } from ...

Images are not displayed when using Flask to serve the Angular front end

After creating an Angular website that interacts with a back-end developed using Flask, my initial goal was to serve the website through Flask. Referencing this answer here, I was able to successfully serve my website on the Flask server. However, I enco ...

Checkbox selections persist when navigating between pages

I am currently working with Angular 9 and I have a list of checkboxes that need to default to true when displaying certain data. If one of these checkboxes is unchecked, it should trigger the display of specific information. The issue I am facing is that o ...