Home Documents Blog

Tables

Structured data displayers for enhancing the presentation of information in a well-organized format.

About

Tables in JTB_MD serve as data containers for your information that tries to enhance the presentation of it in a well-organized format. With offering additional functionalities and customizable styling options tables in JTB_MD tries to create more interactive and engaging content areas for the users in your projects.

How to use

The Table component in JTB_MD seamlessly integrates with the traditional HTML table element. To leverage the enhanced features provided by JTB_MD, you can easily transform your default tables by adding the .jtbTable class to them.

Name Surname Age
Avayah McIntyre 28
Atreus Coffey 27
Maddison Estrada 19
                <!-- Creating table -->
<table class='jtbTable'>
    ...
</table>
            

Since table elements of JTB_MD uses default table elements, you can use eny of its content in library's table components such as thead, tbody, and tfoot.

Header Header Header
Body Body Body
Body Body Body
Footer Footer Footer
                <!-- Creating table with contents -->
<table class='jtbTable'>
    <thead>...</thead>
    <tbody>...</tbody>
    <tfoot>...</tfoot>
</table>
            

Responsiveness

By default tables are elements that tries to fill the container they placed in and has no responsiveness. To make your tables scrollable, depending on screen sizes, you can wrap them with an element with .jtbTable-container class.

Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header Header
Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content
Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content
                    <!-- Creating responsive table -->
<div class='jtbTable-container'>
    <table class='jtbTable'>
        ...
    </table>
</div>
                

Forms

In JTB_MD, various classes are designated for table components to visually enhance elements effortlessly. These table forms are crafted to improve user experience and enhance data readability with distinctive visual elements.

Each of the following forms can be used independently or in combination with others.

No Hover

As evident from the examples above, table elements in JTB_MD come with hoverable rows, enhancing the visibility and differentiation of row elements within the table body. To disable this feature, you can add the .jtbTable-nohover class to your table element.

Header Header Header
Content Content Content
Content Content Content
Content Content Content
                    <!-- Creating table with hover disabled -->
<table class='jtbTable jtbTable-nohover'>...</table>
                

Striped

This form imparts a zebra-like stripe pattern to the rows of the table. To facilitate easier distinction between rows, you can apply this style by adding the .jtbTable-striped class to your table element.

Header Header Header
Content Content Content
Content Content Content
Content Content Content
                    <!-- Creating table with striped rows -->
<table class='jtbTable jtbTable-striped'>...</table>
                

If you want to make columns striped instead of rows, you can add .jtbTable-striped-columns class instead of .jtbTable-striped class.

Header Header Header
Content Content Content
Content Content Content
Content Content Content
                    <!-- Creating table with striped columns -->
<table class='jtbTable jtbTable-columns'>...</table>
                

Bordered

To make borders activated in all edges of cells, you can simply add .jtbTable-bordered class into your table

Header Header Header Header
Header Header Header Header
Header Header
Header Header
Cell Cell Cell Cell Cell Cell Cell Cell
Cell Cell Cell Cell Cell Cell Cell Cell
Cell Cell Cell Cell Cell Cell Cell Cell
Cell Cell Cell Cell Cell Cell Cell Cell
                    <!-- Creating bordered table -->
<table class='jtbTable jtbTable-bordered'>...</table>
                

Borderless

To remove all borders and seperators from table, you can simply add .jtbTable-borderless class into your table element.

Header Header Header
Content Content Content
Content Content Content
Content Content Content
                    <!-- Creating borderless table -->
<table class='jtbTable jtbTable-borderless'>...</table>
                

Equal Columns

To make your column widths all equal, you can add .jtbTable-equal class into your table element.

Header Header Header Header Header
Content Long long content Long long long long content Long long long long long long content Long long long long long long long long content
Content Long long content Long long long long content Long long long long long long content Long long long long long long long long content
Content Long long content Long long long long content Long long long long long long content Long long long long long long long long content
                    <!-- Creating table with equal columns -->
<table class='jtbTable jtbTable-equal'>...</table>
                

Ellipsis

If you want to make your cell content do not exceed one row, you can include .jtbTable-ellipsis class into your table element.

Header Header Header Header Header
Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content
Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content
Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content Long long long long long long long long content
                    <!-- Creating table with ellipsis cells -->
<table class='jtbTable jtbTable-ellipsis'>...</table>
                

Centered

To make your content of cells all centered, you can apply .jtbTable-centered class into your table element.

Header Header Header
Content Content Content
Content Content Content
Content Content Content
                    <!-- Creating table with centered contents -->
<table class='jtbTable jtbTable-centered'>...</table>
                

Styling

Never forget that you can leverage all classes from the Utilities section to seamlessly integrate elements with your design. However, the following pre-defined classes within tables have been crafted to simplify your design workflow.

Sizes

To make your table cells smaller or larger than default you can use one of the pre-defined table classes:

.jtbTable-[ xs | sm | md | lg | xl ]

Header xs Header xs Header xs
Content xs Content xs Content xs
Content xs Content xs Content xs
Content xs Content xs Content xs
Header sm Header sm Header sm
Content sm Content sm Content sm
Content sm Content sm Content sm
Content sm Content sm Content sm
Header md Header md Header md
Content md Content md Content md
Content md Content md Content md
Content md Content md Content md
Header lg Header lg Header lg
Content lg Content lg Content lg
Content lg Content lg Content lg
Content lg Content lg Content lg
Header xl Header xl Header xl
Content xl Content xl Content xl
Content xl Content xl Content xl
Content xl Content xl Content xl
                                <!-- Sized table (xs) -->
<table class='jtbTable jtbTable-xs'>...</table>
                            

Special Features

In JTB_MD, special attributes are defined for table elements to enhance user interaction and experience. The following sections explain different scenarios and usages of these custom features:

Sticky Elements

If you have a table with a fixed height and overflowing content, you can make specific elements of the table sticky by adding the .sticky class to them. This feature allows these elements to remain fixed at the top of the container while scrolling through the content.

You can apply the .sticky class into individual tr elements or directly to a section like thead.

Sticky Sticky Sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Sticky Sticky Sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Sticky Sticky Sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
Not sticky Not sticky Not sticky
                    <!-- Fixed height table with sticky thead & sticky row -->
<div class='jtbTable-container' style='max-height: 400px;'>
    <table class='jtbTable'>
        <thead class='sticky'>
            ...
        </thead>
        <tbody>
            ...
            <tr class='sticky'>
                ...
            </tr>
            ...
        </tbody>
    </table>
</div>
                

Editable Cells

Enable cell editing functionality within your project efficiently by applying the .editable class to the desired container element. Upon class application, JTB_MD automatically grants editing capabilities to all nested cells within that container, streamlining the content editing process.

Header Header Header Header Header Header Header Header Header
Editable Editable Editable Editable Editable Editable Editable Editable Editable
Editable Editable Editable Editable Editable Editable Editable Editable Editable
Editable Editable Editable Editable Editable Editable Editable Editable Editable
Editable Editable Editable Editable Editable Editable Editable Editable Editable
Editable Editable Editable Editable Editable Editable Editable Editable Editable
                    <!-- Editable cells -->
<table class='jtbTable'>
    ...
    <tbody>
        ...
        <tr class='editable'> <!-- Makes all cells under tr editable -->
            ...
        </tr>
        ...
    </tbody>
</table>
                

Copyright © 2024 JTBLabs - All rights reserved.