Table
This is a table design template.
Example
Basic
# | Name | Age | Country | Hobby |
---|---|---|---|---|
1 | Alen | 33 | Japan | Dance, playing music, skateboard, snowboard |
2 | May | 25 | New Zealand | Sing a song |
3 | Lena | 40 | Cyprus | Travel, foods, cooking, yoga, training, reading books, chatting, playing games, exploring, many many hobbies!! |
4 | Tom | 60 | Brazil | Farming |
HTML
<table class="table"> <thead> <tr> <th>#</th> <th>Name</th> <th>Age</th> <th>Country</th> <th>Hobby</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Alen</td> <td>33</td> <td>Japan</td> <td>Dance, playing music, skateboard, snowboard</td> </tr> <tr> <td>2</td> <td>May</td> <td>25</td> <td>New Zealand</td> <td>Sing a song</td> </tr> <tr> <td>3</td> <td>Lena</td> <td>40</td> <td>Cyprus</td> <td>Travel, foods, cooking, yoga, training, reading books, chatting, playing games, exploring, many many hobbies!!</td> </tr> <tr> <td>4</td> <td>Tom</td> <td>60</td> <td>Brazil</td> <td>Farming</td> </tr> </tbody> </table> <div class="table-footer"> <div class="per-page-box"> <p class="txt">Rows per page:</p> <select class="select" name=""> <option value="">50</option> <option value="">100</option> <option value="">200</option> </select> </div> <div class="pagination-box"> <p class="txt">1 - 4 of 50</p> <a class="prev">Prev</a> <a class="next">Next</a> </div> </div>
Stripe
# | Name | Age | Country | Hobby |
---|---|---|---|---|
1 | Alen | 33 | Japan | Dance, playing music, skateboard, snowboard |
2 | May | 25 | New Zealand | Sing a song |
3 | Lena | 40 | Cyprus | Travel, foods, cooking, yoga, training, reading books, chatting, playing games, exploring, many many hobbies!! |
4 | Tom | 60 | Brazil | Farming |
HTML
<table class="table stripe"> ... </table>
Scrollable
# | Name | Age | Country | Hobby |
---|---|---|---|---|
1 | Alen | 33 | Japan | Dance, playing music, skateboard, snowboard |
2 | May | 25 | New Zealand | Sing a song |
3 | Lena | 40 | Cyprus | Travel, foods, cooking, yoga, training, reading books, chatting, playing games, exploring, many many hobbies!! |
4 | Tom | 60 | Brazil | Farming |
HTML
<div class="scroll-table"> <table class="table stripe"> ... </table> </div>
Scrollable & sticky thead
When the table height is specified, you can stick the table header (thead).
# | Name | Age | Country | Hobby |
---|---|---|---|---|
1 | Alen | 33 | Japan | Dance, playing music, skateboard, snowboard |
2 | May | 25 | New Zealand | Sing a song |
3 | Lena | 40 | Cyprus | Travel, foods, cooking, yoga, training, reading books, chatting, playing games, exploring, many many hobbies!! |
4 | Tom | 60 | Brazil | Farming |
HTML
<div class="scroll-table" data-sticky="thead" style="height: 120px;"> <table class="table stripe"> ... </table> </div>
Scrollable & sticky column
Specified data-sticky-column="n" if you want to stick what number of column from left side.
# | Name | Age | Country | Hobby |
---|---|---|---|---|
1 | Alen | 33 | Japan | Dance, playing music, skateboard, snowboard |
2 | May | 25 | New Zealand | Sing a song |
3 | Lena | 40 | Cyprus | Travel, foods, cooking, yoga, training, reading books, chatting, playing games, exploring, many many hobbies!! |
4 | Tom | 60 | Brazil | Farming |
HTML
<div class="scroll-table" data-sticky-column="2"> <table class="table stripe"> ... </table> </div>
Install
npm
Console
> npm i @noknow/web-design-table
Import
CSS
@import '/YOUR_PROJECT/node_modules/@noknow/web-design-table/style.css';
JavaScript
import { Table } from '/YOUR_PROJECT/node_modules/@noknow/web-design-table/index.js';