Table: Striped

About Tables

Tables were once used for layout on the web, but as the web progressed, they are now only used for tabular data.

Guidance

When to use the tables

Some things that could be displayed in tables are tuition and fees or other items that will help the user view data quickly.

When to consider something else

Please consider another component if you are using a table for layout and not for tabular data.

Accessibility Notes

Please consider adding table headers (th) with either a scope="col" or scope="row" to help with anyone who might be using a screen reader.

Using Tables

Tables are available via the WYSIWYG, and an editor can change the style to Table Striped by going to Formats: Custom > Table Striped. For example, an editor could add headers by changing the Row Properties > Row Type to Header, and the Cell Properties > Cell Type to Header Cell.

Component Variants

We currently have four variants:

  • Default, which is what anyone will see when they add a table to a website
    • All table headers (th) will be bold and orange text
  • Striped, which adds zebra striping to a table via the table-design class
    • A background-color of orange will be added to the table head (thead)
      • Two variants of Striped have classes table-design-blue and table-design-grey to change the table head (thead) background

Media Requirements

  • A wrapper class of medium-headline-table helps with any tables larger than 100% of the viewport for mobile responsiveness.
  • No images or videos should be added inside a table

Copy Requirements

Tables should only be used for tabular data and not for layout.

Original Source and Implementation Notes

Original source from: https://utsa-asc.github.io/college-dls/college-dls/reference/navigation-standard.html#table-component

<div class="container">
    <div class="medium-headline-component">
        <h2>Medium Length Display Heading</h2>
    </div>
    <div class="medium-headline-table">
        <table class="table-design">
            <thead>
                <tr>
                    <th scope="col">First Category Title</th>
                    <th scope="col">Second Category Title</th>
                    <th scope="col">Third Category Title</th>
                    <th scope="col">
                        <p>Heading in p tag</p>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <th scope="row">
                        Row One
                    </th>
                    <td>
                        <a href="#">Link<a>
                    </td>
                    <td>
                        <p>
                            <a class="orange-btn" href="#">Action</a>
                            <a class="blue-btn" href="#">Action</a>
                            <a class="grey-btn" href="#">Action</a>
                        </p>
                    </td>
                    <td>
                        Data
                    </td>
                </tr>
                <tr>
                    <th scope="row">
                        Row One
                    </th>
                    <td>
                        <a href="#">Link<a>
                    </td>
                    <td>
                        <p>
                            <a class="orange-btn" href="#">Action</a>
                            <a class="blue-btn" href="#">Action</a>
                            <a class="grey-btn" href="#">Action</a>
                        </p>
                    </td>
                    <td>
                        <ul>
                            <li>Lorem ipsum dolor sit amet consectetur adipisicing elit.</li>
                            <li>Provident porro saepe doloremque labore ipsum inventore recusandae voluptas aperiam, dolore non veniam iure adipisci ipsam laborum.</li>
                            <li>Provident laborum, obcaecati, alias deleniti consectetur harum voluptas exercitationem debitis molestias dolores nihil, quia a ratione repellat asperiores molestiae sed et aperiam aspernatur.</li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <th scope="row">
                        <p>Heading in p tag</p>
                    </th>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                </tr>
                <tr>
                    <td>
                        Row Four
                    </td>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
  • Content:
    /* components/01-visual-styling/02-typography/06-table/table.scss */
    /* BEGIN table.scss */
    .medium-headline-component h2 {
        font-size: 32px;
        color: $blue;
        font-weight: 700;
        margin-bottom: 30px;
    }
    
    table {
    	width: 100%;
    	padding: 0px 15px;
    	margin-bottom: 20px;
    
    	thead th, th {
    		font-weight: bold;
    		font-size: 17px;
    		color: $orange-a11y;
    	}
    	
    	th, td {
    		border: 1px solid $blue;
    		padding: 12px;
    		vertical-align: top;
    	}
    	
    	tr th {
    		padding: 12px 25px;
    	}
    	
    	tr td {
    		padding: 12px 25px;
    		font-size: 17px;
    		color: $blue;
    	}
    }
    
    @mixin striped-table {
    	thead {
    		background-color: $orange-a11y;
    
    		th {
    			color: $white;
    		}
    	}
    
    	th, td {
    		border: 0px;
    	}
    
    	tbody>tr {
    		border-bottom: 1px solid $grey;
    
    		&:nth-child(2n) {
    			background-color: $white-b;
    			border-top: 1px solid $grey;
    		}
    
    		th {
    			color: $blue;
    		}
    	}
    }
    
    .table-design {
    	@include striped-table();
    }
    
    .table-design-grey {
    	@include striped-table();
    
    	thead th {
    		color: $blue;
    	}
    
    	thead {
    		background-color: $grey-b;
    		border-bottom: 1px solid $grey;
    		border-top: 1px solid $grey;
    	}
    }
    
    .table-design-blue {
    	@include striped-table();
    
    	thead {
    		background-color: $blue;
    	}
    }
    
    .mb-0 {
    	margin-bottom: 0px;
    }
    @include media-breakpoint-down(lg) {
    	.medium-headline-table {
    		width: 100%;
    		max-width: 100%;
    		overflow-x: auto;
    	}
    }
    
    /* Dark Mode - Table Styles */
    @include color-mode(dark) {
    	.medium-headline-component h2 {
    		color: $white;
    	}
    	th, th p {
    		color: $orange;
    	}
    
    	table.table tr td, table.table tr th {
    		color: $grey-e;
    		border: 1px solid $grey-e;
    	}
    
    	table th, td {
    		border: 1px solid $grey;
    	}
    	table tr td {
    		color: $white;
    		border: 1px solid $grey;
    		a.orange-btn:hover, .orange-btn:hover{
    			color: $white;
    		}
    		a.grey-btn{
    			color: $blue;
    		}
    	}
    
    	.table-design th, .table-design tr td {
    		border: 1px solid $grey-e;
    	}
    
    	.table-design tbody > tr:nth-child(2n), .table-design-grey tbody > tr:nth-child(2n), .table-design-blue tbody > tr:nth-child(2n), .table-design-blue tbody > tr:nth-child(2n), .table-design-grey thead{
    		color: $blue;
    		a{
    			color: $blue;
    		}	
    		td, th, p, ul li, ol li, h2, h3, h4, h5, h6, th p{
    			color: $blue;
    			a{
    				color: $blue;
    			}			
    		}
    		a.blue-btn{
    			color: $white;
    		}
    		a.orange-btn, .orange-btn:hover{
    			color: $white;
    		}
    		.grey-btn:hover{
    			color: $white;
    		}
    	}
    
    	.table-design tbody > tr {
    		border-bottom: 1px solid $grey-c;
    	}
    
    	.table-design-grey th, .table-design-grey tr td {
    		border: 1px solid $grey-e;
    	}
    
    	.table-design-grey tbody > tr {
    		border-bottom: 1px solid $grey-b;
    	}
    
    	.table-design-blue th, .table-design-blue tr td {
    		border: 1px solid $grey-e;
    	}
    
    	.table-design-blue thead > tr th p, .table-design-blue tbody > tr:nth-child(odd) th p{
    		color: $white;
    	}
    
    	.table-design-blue tbody > tr {
    		border-bottom: 1px solid $grey-b;
    	}
    
    	.table-design tbody > tr:nth-child(odd), .table-design-blue tbody > tr:nth-child(odd), .table-design-grey tbody > tr:nth-child(odd), .table-design thead > tr{
    		th, th p{
    			color: $white;
    		}
    		a.orange-btn:hover, .orange-btn:hover{
    			color: $white;
    		}
    		a.grey-btn{
    			color: $blue;
    			&:hover{
    				color: $white;
    			}
    		}		
    	}
    
    	.tab-wrapper .tab-content .tab-body-content {
    		table tbody tr td {
    			color:$blue;
    			border: 1px solid $blue;
    		}
    		table thead tr th {
    			border: 1px solid $blue;
    		}
    
    		.table-design, .table-design-blue, .table-design-grey {
    			th, tr td{
    				border: 0;				
    			}			
    		}
    
    		table.table-design tbody tr td {
    			color:$blue;
    			border:none;
    		}
    
    		table.table-design-blue tbody tr td {
    			color:$blue;
    			border:none;
    		}
    
    		table.table-design-grey tbody tr td {
    			color:$blue;
    			border:none;
    		}
    
    
    		.table-design, .table-design-blue, .table-design-grey {
    			tbody tr td, tbody tr th p, tbody>tr:nth-child(odd) th{
    				color:$blue;
    				border:none;
    			}
    		}
    
    		table.table-design, table.table-design-blue, table.table-design-grey{
    			thead tr th {
    				border:none;
    			}
    		}		
    	}
    
    	.accordion .accordion-item .accordion-body-content {
    
    		th, th p {
    			color: $blue;
    		}
    
    		.table-design thead th, .table-design-blue thead th {
    			color: $white;
    			p{
    				color: $white;
    			}
    		}
    
    		th,
    		td {
    			border: 1px solid $grey-e;
    		}
    
    		.table-design, .table-design-blue, .table-design-grey {
    			th, tr td{
    				border: 0;
    			}
    		}
    
    		table tbody tr td {
    			color:$blue;
    			border: 1px solid $blue;
    		}
    		table thead tr th {
    			border: 1px solid $blue;
    		}
    
    		.table-design, .table-design-blue, .table-design-grey {
    			tbody tr td, tbody tr th p, tbody>tr:nth-child(odd) th{
    				color:$blue;
    				border:none;					
    			}		
    		}
    
    		table.table-design, table.table-design-blue, table.table-design-grey{
    			thead tr th {
    				border:none;
    			}
    		}
    
    	}
    }
    /* Dark Mode - Table END */
    
    /* END table.scss */
  • URL: /components/raw/table/table.scss
  • Filesystem Path: components/01-visual-styling/01-typography/06-table/table.scss
  • Size: 4.8 KB
<div class="container">
    <div class="medium-headline-component">
        <h2>{{ heading }}</h2>
    </div>
    <div class="medium-headline-table">
        <table class="table-design">
            <thead>
                <tr>
                    <th scope="col">First Category Title</th>
                    <th scope="col">Second Category Title</th>
                    <th scope="col">Third Category Title</th>
                    <th scope="col"><p>Heading in p tag</p></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <th scope="row">
                        Row One
                    </th>
                    <td>
                        <a href="#">Link<a>
                    </td>
                    <td>
                            <p>{{render '@button--orange'}} {{render '@button'}} {{render '@button--grey'}}</p>
                    </td>
                    <td>
                        Data
                    </td>
                </tr>
                <tr>
                    <th scope="row">
                        Row One
                    </th>
                    <td>
                        <a href="#">Link<a>
                    </td>
                    <td>
                        <p>{{render '@button--orange'}} {{render '@button'}} {{render '@button--grey'}}</p>
                    </td>
                    <td>
                        <ul>
                            <li>Lorem ipsum dolor sit amet consectetur adipisicing elit.</li>
                            <li>Provident porro saepe doloremque labore ipsum inventore recusandae voluptas aperiam, dolore non veniam iure adipisci ipsam laborum.</li>
                            <li>Provident laborum, obcaecati, alias deleniti consectetur harum voluptas exercitationem debitis molestias dolores nihil, quia a ratione repellat asperiores molestiae sed et aperiam aspernatur.</li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <th scope="row">
                        <p>Heading in p tag</p>
                    </th>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                </tr>
                <tr>
                    <td>
                        Row Four
                    </td>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                    <td>
                        Data
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>