Horizontal chip list in Material Angular 6 displayed as a sleek single-line design

Is it possible to implement a horizontal chip list in Material Angular that scrolls horizontally instead of expanding into multiple rows?

Answer №1

We found the solution with this piece of code:

(Additionally, we included

encapsulation: ViewEncapsulation.None
in our component).

::-webkit-scrollbar {
  height: 0;
}

div.mat-chip-list-wrapper {
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 165px;
  white-space: nowrap;

  .mat-chip {
    flex: 0 0 auto;

    background: transparent;
    color: var(--white);
  }
}

.mat-chip-list {
  margin-left: 20px;
}

.mat-chip.mat-standard-chip .mat-chip-remove {
  color: var(--white);
}

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

Sending data to the makeStyle function in TypeScript

How can I set the style of backgroundImage in my React component based on the value of post.mainImage? Here is the code snippet: import React from 'react'; import { Post } from '../interfaces'; import { makeStyles, createStyles, Theme ...

Challenges of implementing dark mode with a checkbox and local storage

I'm experiencing an issue with local storage. When I enable the dark mode, everything functions properly and the local storage 'dark' is set to true. However, upon refreshing the page, the local storage remains true but the toggle switches b ...

The Firebase database is experiencing difficulties fetching the data

Having an issue with my component. Struggling to retrieve data from Firebase. Can someone spot the error in the code below? import { Component, OnInit, Input, ViewChild } from '@angular/core'; import { AngularFireDatabase, FirebaseListObservable ...

Fixing errors with observables in an Angular 2 project using Rx

var foo = Observable.create(function(observer){ try{ console.log('hey there'); observer.next(22); throw new Error('not good at all'); setTimeout(function(){ observe ...

Browser inspect tool is failing to hit breakpoints when using USB-connected device

While troubleshooting my Ionic Capacitor application on a USB connected device, I noticed that my browser dev-tools (Chrome, Edge, Firefox) are not hitting my breakpoints in the source code. Interestingly, when I run the application on ionic serve, everyt ...

Deliver an Angular 2 project using a static directory secured with Spring Security

I have successfully set up a frontend using Angular2 and a backend with Java. Currently, I am serving my index.html from the static folder along with other frontend resources. However, upon adding Spring Security to the backend using the @EnableWebSecurity ...

What causes the lack of minlength validation when the form is in its initial state?

Check out the code snippet below: <input [(ngModel)]="someProperty" minlength="5" /> I recently ran my app and used the browser debugger tool to inspect the state of this input field. Surprisingly, I noticed that it was marked as ...

Discovering Angular: A Guide to Displaying Dropdown Items in Dropdown Buttons

I'm seeking guidance on dropdown buttons. Here is some code I found in an example: <!--adjustbtn is a class I created to style the button--> <button class="dropdown adjustbtn" style="border-radius: 5px; box-shad ...

Efficient ways to exchange data at the application level across pages in Angular 2 and higher versions

Throughout my experience with various Angular projects, I have encountered the challenge of effectively sharing application-level data between different pages. There are several methods to tackle this issue, such as using a service and injecting it into p ...

Error management and callback handling in MSAL.js for Angular 6 Single Page Applications

I am currently using msal.js in an angular 6 SPA for authentication purposes, but I have encountered a few issues: Initially, I struggled to find clear examples on how to handle errors with the library, so I pieced together information from various source ...

Angular 2/4 throws an Error when a Promise is rejected

I implemented an asynchronous validator function as shown below. static shouldBeUnique(control: AbstractControl): Promise<ValidationErrors | null> { return new Promise((resolve, reject) => { setTimeout(() => { if (contr ...

Typescript disregarding conditional statements

Looking for some assistance with a Next.JS React-Typescript application Here's my code snippet for handling the video HTML element const videoRef = useRef<HTMLVideoElement>(); useEffect(() => { videoRef !== undefined ? videoRef.current. ...

Display the most recent information retrieved from Local Storage using Angular 7 [Resolve]

In my application, I have a component called "edit-user" where users can edit their name or surname. This data is properly loaded and refreshed in the Local Storage, and the service works fine as the new data reflects changes in the database. However, the ...

Initiating the ngOnInit lifecycle hook in child components within Angular

I am facing an issue with controlling the behavior of child components in my Angular application. The problem arises when switching between different labels, causing the ngOnInit lifecycle hook of the children components not to trigger. The main component ...

Aligning Bootstrap Buttons

How do I create a gap between my Bootstrap4 button and the top of the table, while also aligning it to the edge of the table? <div class="container"> <div class="table-title"> <div class="row"> ...

Encountering issues when passing a string as query parameters

How can I successfully pass a string value along with navigation from one component to another using query parameters? Component1: stringData = "Hello"; this.router.navigate(['component2'], { queryParams: stringData }); Component2: ...

Issues with NextJS detecting environmental variables

I recently encountered an issue with my NextJS app running on Next.js v12.2.5 where it appears to be ignoring the environment variables I've configured. To address this, I created a .env.local file with the following content: NEXT_PUBLIC_SERVER_URL=h ...

Axios throws an error stating "Response not defined for 302 status

I am currently using axios in conjunction with TypeScript. Below is a simple axios interceptor that I have implemented: // Adding a response interceptor axios.interceptors.response.use((response: AxiosResponse<any>) => { // Processing response ...

Simplifying imports in Angular, the easy way: A guide to stream

We recently made a change to our Angular project by moving the npm-library @ng-plus/modal to live as a project library under the project/ngplus-modal folder. One issue we encountered is with the imports within the project. Even though we previously def ...

Tips for managing update logic in the server side with sveltekit

Currently, I am using Sveltekit and I am facing a dilemma regarding updating input data. The actual update process is straightforward, but there is an issue that arises when trying to send an update API request immediately, as it requires an accessToken to ...