Table

A thin wrapper around the native <table> element that applies Bootstrap table styling. Toggle [responsive] to wrap the table in a horizontally scrollable container on narrow viewports.

Basic usage

#First nameLast nameNicknameOccupationDate of birthPlace of birthDate of deathPlace of death
1TimBerglingAviciiMusic artist1989/09/08Stockholm2018/04/20Muscat
2IvanPetuninWalkieRapper1995/05/24Russia2022/09/30Krasnodar
3MichaelJacksonMichael JacksonSinger1958/08/29Gary2009/06/25Los Angeles
  
    
      
        <bs-table [responsive]="true">
        
    
      
          <thead>
        
    
      
            <tr>
        
    
      
              <th>#</th>
        
    
      
              <th>First name</th>
        
    
      
              <th>Last name</th>
        
    
      
            </tr>
        
    
      
          </thead>
        
    
      
          <tbody>
        
    
      
            @for (person of people; track person.id) {
        
    
      
              <tr>
        
    
      
                <th scope="row">{{ person.id }}</th>
        
    
      
                <td>{{ person.firstName }}</td>
        
    
      
                <td>{{ person.lastName }}</td>
        
    
      
              </tr>
        
    
      
            }
        
    
      
          </tbody>
        
    
      
        </bs-table>
        
    
  
    
      
        import { Component } from '@angular/core';
        
    
      
        import { BsTableComponent } from '@mintplayer/ng-bootstrap/table';
        
    
      
        
        
    
      
        interface Person {
        
    
      
          id: number;
        
    
      
          firstName: string;
        
    
      
          lastName: string;
        
    
      
        }
        
    
      
        
        
    
      
        @Component({
        
    
      
          selector: 'my-table-demo',
        
    
      
          templateUrl: './my-table-demo.component.html',
        
    
      
          imports: [BsTableComponent],
        
    
      
        })
        
    
      
        export class MyTableDemoComponent {
        
    
      
          protected readonly people: Person[] = [
        
    
      
            { id: 1, firstName: 'Tim', lastName: 'Bergling' },
        
    
      
            { id: 2, firstName: 'Ivan', lastName: 'Petunin' },
        
    
      
            { id: 3, firstName: 'Michael', lastName: 'Jackson' },
        
    
      
          ];
        
    
      
        }