Tips for arranging columns and rows in a mat-dialog box

In my Angular project, I am working on a mat dialog box and trying to achieve a layout with 1 row at the top and 3 rows at the bottom, similar to the image below. However, I am facing issues in making it work properly. Additionally, I want to hide the horizontal scroll bar by adjusting the width property, but for some reason, it is still visible. Any suggestions?

HTML

<div mat-dialog-content class="dialog-container">
  <div class="column">
    <div class="header">Tops</div>
  </div>
  <div class="parent">
      <div class="left">
          <div class="sub-header">Left</div>
          <div style="background-color: darkblue;">
            <div></div>
          </div>
      </div>
      <div class="center">
        <div class="sub-header">Center</div>
    </div>  

      <div class="right">
          <div class="sub-header">Right</div>
      </div>
  </div>
</div>

CSS

.dialog-container{
    width: 1000px;
    height:1000px;
    overflow-x:hidden;
}   
.header{
    position: relative;
    font-size: 20px;
    text-align: center;
    font-family: 'Raleway';
}
.button{
    margin-top: 15px;
    align-items: center;
}
.clickable {
    cursor: pointer;
}

.parent {
    display: flex;
    overflow: hidden;
}

.column{
    display: flex;
    flex-direction: column;
    background-color: blue;
}

.left {
    width: 200px;
    background-color: green;
}

.right {
    width: 300px ;
    background-color: blue;
}

.center{
    width: 300px;
    background-color: red;
}

.header{
    font-size: 30px;
    font-family: "Raleway-ExtraLight";
    padding: 30px;
}

.sub-header{
    font-size: 20px; 
    margin-top: 25px;
    font-weight: bold;
}

Current View

Desired Layout

I'm experimenting with different column and row configurations to match the final design. Any recommendations would be greatly appreciated.

Answer №1

To create a grid layout, you can utilize mat-grid where you define the number of rows and columns required. In this case, 4 columns and 4 rows are specified. The buttons at the bottom can be placed within the mat-dialog-actions div specifically designed for them. If you want to see an example using mat-grid-list, check out this Demo on StackBlitz

In case the demo link isn't working, here is the code snippet for you to try:

html:

<mat-grid-list cols="18" rowHeight="1:3">
  <mat-grid-tile [colspan]="3">Map Insights</mat-grid-tile>
  <mat-grid-tile [colspan]="7">
    <input type="text" placeholder="blablabla" />
  </mat-grid-tile>
  <mat-grid-tile></mat-grid-tile>
  <mat-grid-tile [colspan]="7"><i>Blablablabla your text in italic</i></mat-grid-tile>


  <mat-grid-tile [rowspan]="5" [colspan]="3">Your side bar</mat-grid-tile>
  <mat-grid-tile [rowspan]="5" [colspan]="7"></mat-grid-tile>
  <mat-grid-tile [rowspan]="5">=></mat-grid-tile>
  <mat-grid-tile [rowspan]="5" [colspan]="7"></mat-grid-tile>
</mat-grid-list>

css:

mat-grid-tile {
  background: lightblue;
}

The CSS styling is included solely for visualization purposes ;)

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

Issue with compatibility of Angular Elements across Chrome and IE11 at the same time

Experimenting with Angular Elements has led me to focus on achieving optimal browser compatibility. However, I have encountered a roadblock where adding an IE polyfill for Shadow DOM breaks the Element in Chrome. Initially, I faced the error 'Failed ...

Karma Jasmin is puzzled as to why her tests are failing intermittently, despite the absence of any actual test cases

In this snippet, you will find my oninit method which I am instructed not to modify. ngOnInit(): void { this.setCustomizedValues(); this.sub = PubSub.subscribe('highlightEntity', (subId, entityIdentifier: string) => { ...

Guide to generating a text string by utilizing the foreach loop

Is there a way to combine text strings from interfaces into a single file for display in UI? The current code is generating separate files for each interface. How can I achieve the expected result of having all interfaces in one file? Additionally, is it ...

Using HTML to load an image is not possible, as it can only be done using CSS

I am currently dealing with a CSS issue in my project. Here is the code snippet from my stylesheet: .Img{ background: url('../assets/Trump.png'); } Now, let's take a look at the corresponding HTML code: <div class="Img"> However, ...

When attempting to replace the outdated Angular 2 router with the new Router, I encountered an error

I have the main app component and I want to add subroutes under the admin component like /admin/users, /admin/subscribers @Component({ selector: 'my-app', template: `<router-outlet></router-outlet>` directives: [ROUTER_DI ...

Using observable object fields as query parameters in Firestore allows for dynamic filtering and retrieval

I have two separate services in my Angular project: an Auth service and a query service. The Auth service handles user authentication by managing the login process and observing changes to the user object. import {Injectable} from '@angular/core&apo ...

Navigating Using URL Paths in Angular 2 Application

I have my Angular 2 application hosted on an S3 server. Here is how the routing file is set up: const APP_ROUTES: Routes = [ { path: 'checkout', component: CheckoutComponent }, { path: 'thankyou', component: ThankyouComponent }, ...

What is the best way to extract information from an observable stream?

Within my codebase, there exists an observable that I have defined as: public selectedObjectsIds$ = of(); In addition, there is another stream present: this.reportMode$.pipe( filter((state: ReportMode) => state === ReportMode.close) ) .subscribe(() ...

The Bootstrap navbar collapse fails to expand in the appropriate location

Whenever I try to expand the navigation on mobile mode by clicking the button, it doesn't push the content downwards. Instead, it just opens a small menu next to the button. Did I make a mistake in my code? <div class = "container"> ...

Creating a Sticky Header and Footer with Responsive Design: Ensuring Content Div Expansion between Them

Greetings. I am working on creating a simple responsive HTML layout as described below: HTML: <div id="header"></div> <div id="content"></div> <div id="footer"></div> CSS: #header{ wi ...

Dynamic flexibility for content scrolling across components

Creating a mobile-friendly terms of service page with a title, content, and two buttons is my current project. The specific requirements are: All components should not exceed 100% of the viewport to allow for scrolling The buttons need to stay sticky at t ...

Is there an alternative to using CSS units of measurement when using the .css() method?

Is there a way to use .scrollTop() and .css() to adjust the margins of an element so that it floats up only when the page is scrolled, but stops at a certain margin value? I want the element to float between specific values while scrolling. The issue I am ...

Unable to load dynamic JSON data in ag-grid for Angular 2

ngOnInit(){ this.gridOptions = {}; this.gridOptions.rowData = []; this.gridOptions.rowData = [ {configName: 1, configName1: "Jarryd", configName2: "Hayne", configName3: "tttttt", configName4: "rrrtttt", configName5:"drrrrrr"}]; } ...

Step-by-step guide for setting up automatic Tslint in IntelliJ

When working on an Angular project in Intellij, I often encounter numerous tslint errors while coding. Is there a command within Intellij that can automatically fix all of these lint errors? ...

Find the length of time in Typescript (measured in hours, minutes, and seconds)

Trying to calculate the duration between two dates in TypeScript (Angular): 2021-11-19 21:59:59 and 2021-11-19 22:00:18 let startDate: Date = new Date(start); let endDate: Date = new Date(end); if(end != null) { let duration = new Date(endDate.getT ...

Using Angular to access HTML content through the .ts file

Is there a way to retrieve the value of the input field [newUser] when clicking on the button and executing the action [onAddUser()] in the .ts file? <input type="text" ng-model="newUser" style="text-align:center"/> <button (cl ...

Does the a:hover:not() exception only apply to elements with the .active class?

I developed a navigation bar and split it into 3 distinct sections: 1. id="menu" 2. id="fake" (button to fill space) 3. id="social" My main goal is to exclude the .active page and the fake button from the hover effect, but it seems that using a:hover:not( ...

Is there a callback or event that can be used to ensure that getComputedStyle() returns the actual width and height values?

Currently, I find myself in a situation where I need to wait for an image to load before obtaining its computed height. This information is crucial as it allows me to adjust the yellow color selector accordingly. Question: The process of setting the yello ...

Verify if the page was generated as a regular Page or a modal page

Within the UpgradePage, I have a scenario where I want to navigate to the same page either through the side menu or as a modal page using push/setRoot. Q: The method upgradeLater() is where I need to make a decision on whether to redirect to another page, ...

Tips for implementing 'transloco' on the 'pie-chart' component in an Angular project

Below is the code snippet: .HTML: <div fxFlex> <ngx-charts-pie-chart [view]="view" [scheme]="colorScheme" [results]="single0" ...