Is there a way to adjust the height of mat-sidenav-content to be 100%?

I'm having trouble scrolling down my mat-sidenav-content to reach the bottom where my pagination is located. When I try using fullscreen on mat-sidenav-container, my mat-toolbar disappears. How can I adjust my mat-sidenav-content based on the content? Check out the image below:

https://i.stack.imgur.com/w8KkX.jpg

author.component.html

<mat-sidenav-container class="example-container">
  <mat-sidenav mode="side" opened>
      <mat-list class="mt-5">
          <mat-list-item><mat-icon class="me-2">book</mat-icon><a routerLink="/book">Book</a></mat-list-item>
          <mat-divider></mat-divider>
          <mat-list-item><mat-icon class="me-2">supervisor_account</mat-icon><a routerLink="/author">Author</a></mat-list-item>
          <mat-divider></mat-divider>
          <mat-list-item><mat-icon class="me-2">local_offer</mat-icon><a routerLink="/category">Category</a></mat-list-item>
          <mat-divider></mat-divider>
          <mat-list-item><mat-icon class="me-2">folder_shared</mat-icon><a routerLink="/publisher">Publisher</a></mat-list-item>
      </mat-list>
  </mat-sidenav>

  <!-- Main Content -->
  <mat-sidenav-content id="content">
    <mat-card class="header mat-elevation-z5">
      <mat-card-title class="mt-2">Author</mat-card-title>
      <button mat-raised-button color="warn" class="add-button" (click)="openAddModal()">Add new</button>
    </mat-card>
    
    <br>
    
    <div class="example-container float-end">
      <mat-form-field class="example-full-width" appearance="fill">
        <mat-label>Filter</mat-label>
        <input matInput placeholder="Search...">
      </mat-form-field>
    </div>

    <br>
    
    <table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
        <!-- Price Column -->
        <ng-container matColumnDef="authorname">
          <th mat-header-cell *matHeaderCellDef> Author </th>
          <td mat-cell *matCellDef="let element"> {{element.authorname}} </td>
        </ng-container>
    
        <ng-container matColumnDef="actions">
            <th mat-header-cell *matHeaderCellDef> Actions </th>
            <td mat-cell *matCellDef="let element">
              <button mat-raised-button color="primary" (click)="updateClick()">Edit</button>
            </td>
        </ng-container>
      
        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
    </table>

    <mat-paginator class="mat-elevation-z5" [pageSize]="10" 
      [pageSizeOptions]="[10, 25, 50, 75, 100]" 
      showFirstLastButtons 
      aria-label="Select page">
    </mat-paginator>

  </mat-sidenav-content>
</mat-sidenav-container>

author.component.css

#content {
    width: 82%;
    padding: 20px;
    min-height: 100vh;
    transition: all 0.3s;
    background: rgb(240, 237, 237);
}
mat-sidenav-container {
    height: 100%;
}
mat-sidenav {
    width: 18%;
    background-color: #fff;
}
mat-list-item a {
    text-decoration: none;
    color: #000;
}

Answer №1

If you want to enhance the appearance of your table, consider using the following CSS code:

overflow: auto;

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

Having trouble locating the angular-devkit while trying to update Angular

I encountered the following error message: An unhandled exception occurred: Cannot find module '@angular/compiler-cli' See "C:\Users\rashe\AppData\Local\Temp\ng-s9ZG05\angular-errors.log" for further details. ...

Is it possible to inject a descendant component's ancestor of the same type using

When working with Angular's dependency injection, it is possible to inject any ancestor component. For example: @Component({ ... }) export class MyComponent { constructor(_parent: AppComponent) {} } However, in my particular scenario, I am tryin ...

Choose from a variety of options for color schemes and hover effects

Looking to create a selector where users can pick a color. I tried changing the background color for each option, but when hovering over them, the background turns blue - which is not what I want. Check out the pictures for clarification: After doing some ...

Modifying Font Style in Angular 4 Material

Is there a way to change the font in Angular 4 Material material.angular.io using the styles file in .CSS format instead of SASS? While the documentation offers an example for SASS at: https://github.com/angular/material2/blob/master/guides/typography.md ...

Having trouble importing SVG as a React component in Next.js

I initially developed a project using create-react-app with Typescript, but later I was tasked with integrating next.js into it. Unfortunately, this caused some SVGs throughout the application to break. To resolve this issue, I implemented the following pa ...

Calculating the time difference between two dates in the format yyyy-MM-ddTHH:mm:ss.fffffff can be done by following these steps

Can someone help me figure out how to calculate the difference in days between the date and time 2021-02-23T08:31:37.1410141 (in the format yyyy-MM-ddTHH:mm:ss.fffffff) obtained from a server as a string, and the current date-time in an Angular application ...

How to Append Data to an Empty JSON Object in Angular

I have started with an empty JSON object export class Car {} After importing it into my component.ts, I am looking to dynamically add fields in a loop. For example: aux = new Car; for (var i = 0; i < 10; i++) { car.addName("name" + i); } My aim is ...

Having trouble resolving all parameters for the service in an Angular2 test with Jasmine mocking

I am currently attempting to create a mock service for testing purposes: Production: @Injectable() export class UserService extends DtoService { // irrelevant details here. } @Injectable() export abstract class DtoService { constructor(private h ...

The Angular Material Dialog refuses to close

I am facing a unique problem where my MatDialog component, once opened, refuses to close in my Angular application. The calling component uses SVG instead of HTML as the view, which seems to be causing some handling issues. Unfortunately, I have been unabl ...

The function signature '() => Element' is incompatible with the type 'string'

Greetings! I have a standard function that returns a span with a prop (if I'm not mistaken). In my TS code, I am encountering this error: Error image Below is the code from the file named qCard.tsx: import { QuestionAnswerTwoTone } from "@material- ...

When trying to access a certain class property, I was met with the following error message: TypeError: Unable to read/set property 'x' of

Lately, I've delved into the realm of JavaScript / TypeScript and decided to create a basic React App using TypeScript. Within one of my components, I aim to switch between different components using a "state" (where each component will follow the pre ...

What is the process of incorporating a custom data type with ngModel in Angular Dart?

In the process of developing an app using AngularDart, I have come across some interesting challenges. While I appreciate the ease with which forms can be handled in AngularDart, I am facing a hurdle when it comes to working with different data types. My ...

Combining GroupBy and OrderBy Features in Ionic2 using Angular2

Is there a way to organize an array of data by hostname (link) and sort it by date data in Angular2? I'm currently using an API that returns the following array: this.items = [ {name: "banana", link: "https://wiki.com/what-ever/mmmmmmmmm/mdmdm", ...

Child routes cannot be included when ..., so make sure to specify "..." in the parent route path

I've been working on setting up child routing within my project, and here is the current folder structure I have: app |--home/ | |--home.component.ts |--login/ | |--login.ts |--appShell/ | |--app.component.ts |--apps/ |- ...

Angular button will be disabled if the form control is empty

Is there a way to deactivate the search button when the text box is empty? I attempted to use the "disabled" attribute on the search button, but it didn't work. Here is my HTML code: <div class="col-md-5 pl-0"> <div class="in ...

Align item in center of remaining space within container using Material-UI React

I am relatively new to MUI and styling HTML components, and I have a query. I'm currently utilizing the Grid feature in my React project. My goal is to achieve something similar to this (image edited in Paint, alignment may not be accurate): https://i ...

Develop a series of sequential tests for the playwright to execute

Can someone assist me with my code? I am attempting to write a test in Playwright that navigates to the forgot password page, creates a new password, and then tries to log in using that new password. However, I am encountering an issue with retrieving the ...

Can someone guide me on how to make a Carousel responsive using Angular?

HTML: <div class="voxel-row"> <div class="voxel-col-4"><h2 id="vagas_recentes">vagas recentes</h2></div> </div> <div id="carouselExampleControls" cl ...

React Redux not properly handling text input updates when onChange event is triggered

I have come across similar inquiries, but they haven't provided the solution I need. Currently, I am working on a React project where I am integrating redux. This is how my index.js looks: import React from "react"; import ReactDOM from "react-dom"; ...

Issue with PrimeNG Carousel width on mobile devices

Currently, I am in the process of developing a system interface with Angular and PrimeNG specifically for mobile devices. The main requirement is to have a carousel to display a set of cards. After evaluating different options, I decided to utilize the ngP ...