Docs
Table
Overview
Important
Bootstrap styling attributes require an explicit class argument as of release v0.22.0 . For example, use the following argument to accentuate a table with table-striped:
class="table-striped".
Responsive Table
Use the table shortcode to make your markdown table responsive. Responsive tables scroll horizontally to improve the layout on smaller screens. The following example illustrates how this works.
| # | Heading | Heading | Heading | Heading | Heading | Heading | Heading | Heading | Heading |
|---|---|---|---|---|---|---|---|---|---|
| 1. | cell | cel | cel | cel | cel | cel | cel | cel | cel |
| 2. | cell | cel | cel | cel | cel | cel | cel | cel | cel |
| 3. | cell | cel | cel | cel | cel | cel | cel | cel | cel |
{{< table >}}
| # | Heading | Heading | Heading | Heading | Heading | Heading | Heading | Heading | Heading |
|----|---------|---------|---------|---------|---------|---------|---------|---------|---------|
| 1. | cell | cel | cel | cel | cel | cel | cel | cel | cel |
| 2. | cell | cel | cel | cel | cel | cel | cel | cel | cel |
| 3. | cell | cel | cel | cel | cel | cel | cel | cel | cel |
{{< /table >}}Data Table
Include the module simple-datatables to add advanced controls to your table. Features include in-line pagination, search, and sorting. Include the module in the frontmatter of your content page:
---
modules: ["simple-datatables"]
---As an example, the following shortcode displays a responsive table that is searchable, sortable, and enables paging (paginate) with a page size (pagination) of 5.
| # | Heading |
|---|---|
| 1. | Item 1 |
| 2. | Item 2 |
| 3. | Item 3 |
| 4. | Item 4 |
| 5. | Item 5 |
| 6. | Item 6 |
| 7. | Item 7 |
| 8. | Item 8 |
| 9. | Item 9 |
| 10. | Item 10 |
| 11. | Item 11 |
| 12. | Item 12 |
| 13. | Item 13 |
| 14. | Item 14 |
| 15. | Item 15 |
{{< table searchable="true" sortable="true" paginate="true" pagination=5 >}}
| # | Heading |
|-----|---------|
| 1. | Item 1 |
| 2. | Item 2 |
| 3. | Item 3 |
| 4. | Item 4 |
| 5. | Item 5 |
| 6. | Item 6 |
| 7. | Item 7 |
| 8. | Item 8 |
| 9. | Item 9 |
| 10. | Item 10 |
| 11. | Item 11 |
| 12. | Item 12 |
| 13. | Item 13 |
| 14. | Item 14 |
| 15. | Item 15 |
{{< /table >}}Configuration
With Simple Datatables
enabled, add the attribute data-table to the class of any Markdown table. The following arguments are supported:
| Argument | Default | Description |
|---|---|---|
data-table-sortable |
true |
Toggle the ability to sort the columns. |
data-table-paging |
true |
Whether paging is enabled for the table. |
data-table-paging-option-perPage |
10 |
Paging option: Sets the maximum number of rows to display on each page. Type: int |
data-table-paging-option-perPageSelect |
[5, 10, 20, 50, ["{{ T "tablePerPageSelectAll" }}", -1]] |
Paging option: Sets the per page options in the dropdown. i18n translation id for all: tablePerPageSelectAll. |
data-table-searchable |
true |
Toggle the ability to search the dataset. |
Styling
The file assets/scss/components/_table.scss defines the Hinode-specific styling of the table shortcode.
.datatable-container {
border-bottom: none if($enable-important-utilities, !important, null);
}
.datatable-bottom {
padding-top: 0 if($enable-important-utilities, !important, null);
}
.datatable-sorter {
padding-left: 0;
padding-right: 1rem;
}
.table-border-bottom-wrap {
border-bottom-style: none !important
}
@if $enable-dark-mode {
@include color-mode(dark) {
.table-striped, .table-striped-columns {
--bs-table-striped-bg: var(--bs-tertiary-bg);
--bs-table-striped-color: var(--bs-body-color);
}
.table-hover {
--bs-table-hover-bg: var(--bs-tertiary-bg);
--bs-table-striped-color: var(--bs-body-color);
}
.datatable-pagination-list-item {
&:hover,
&:focus,
&.datatable-active {
color: var(--bs-body-bg) !important;
}
}
}
}Arguments
The shortcode supports the following arguments:
| Name | Type | Required | Default | Comment |
|---|---|---|---|---|
| breakpoint | select | Breakpoint of the element. Supported values: [none, xs, sm, md, lg, xl, xxl]. |
||
| class | string | Class attributes of the element. It supports Bootstrap attributes to modify the styling of the element. | ||
| pagination-select | string |
v1.23.0
Sets the per page options in the dropdown. Must be an array of integers or arrays in the format [label (string), value (int)]. Requires paginate = true. It is recommended to configure values that are a multitude of the pagination value. |
||
| paging | bool |
v0.24.13
v1.23.0
Use paginate instead. Whether paging is enabled for the table. |
||
| pagingOptionPageSelect | string |
v0.27.8
v1.23.0
Use pagination-select instead. Sets the per page options in the dropdown. Must be an array of integers or arrays in the format [label (string), value (int)]. Requires paginate = true. |
||
| pagingOptionPerPage | int |
v0.27.8
v1.23.0
Use pagination instead. Sets the maximum number of rows to display on each page. Requires paging = true. |
||
| searchable | bool | v0.24.13 Toggle the ability to search the dataset. | ||
| sortable | bool | v0.24.13 Toggle the ability to sort the columns. | ||
| wrap | bool | Toggle the last column to wrap to a new row on smaller devices. This setting is not compatible with data tables. | ||
| wrapper | string |
v2.0.0
Class attribute of the element’s wrapper. It supports Bootstrap attributes to modify the styling of the element. Icons include the fa-wrapper and fa-fluid attributes by default. |
| Name | Type | Required | Default |
|---|---|---|---|
| breakpoint | select | ||
Breakpoint of the element. Supported values: [none, xs, sm, md, lg, xl, xxl]. |
|||
| class | string | ||
| Class attributes of the element. It supports Bootstrap attributes to modify the styling of the element. | |||
| pagination-select | string | ||
v1.23.0
Sets the per page options in the dropdown. Must be an array of integers or arrays in the format [label (string), value (int)]. Requires paginate = true. It is recommended to configure values that are a multitude of the pagination value. |
|||
| paging | bool | ||
v0.24.13
v1.23.0
Use paginate instead. Whether paging is enabled for the table. |
|||
| pagingOptionPageSelect | string | ||
v0.27.8
v1.23.0
Use pagination-select instead. Sets the per page options in the dropdown. Must be an array of integers or arrays in the format [label (string), value (int)]. Requires paginate = true. |
|||
| pagingOptionPerPage | int | ||
v0.27.8
v1.23.0
Use pagination instead. Sets the maximum number of rows to display on each page. Requires paging = true. |
|||
| searchable | bool | ||
| v0.24.13 Toggle the ability to search the dataset. | |||
| sortable | bool | ||
| v0.24.13 Toggle the ability to sort the columns. | |||
| wrap | bool | ||
| Toggle the last column to wrap to a new row on smaller devices. This setting is not compatible with data tables. | |||
| wrapper | string | ||
v2.0.0
Class attribute of the element’s wrapper. It supports Bootstrap attributes to modify the styling of the element. Icons include the fa-wrapper and fa-fluid attributes by default. |
|||
Input Type
| Name | Type | Required | Default | Comment |
|---|---|---|---|---|
| categories | string, slice | Categories to be used as filter. When set, only pages that belong to at least one of the provided categories are retrieved. | ||
| keywords | string, slice | Keywords to be used as filter. When set, only pages that match at least one of the provided keywords are retrieved. | ||
| nested | bool | If set, retrieves all pages below the section or current page recursively. By default, only first-order children are retrieved. | ||
| reverse | bool | true |
Sets the sort order to descending. | |
| section | string | Name of the content section. | ||
| sort | select | yes | Key to sort by. Supported values: [date, title, weight]. |
|
| tags | string, slice | Tags to be used as filter. When set, only pages that match at least one of the provided tags are retrieved. |
| Name | Type | Required | Default |
|---|---|---|---|
| categories | string, slice | ||
| Categories to be used as filter. When set, only pages that belong to at least one of the provided categories are retrieved. | |||
| keywords | string, slice | ||
| Keywords to be used as filter. When set, only pages that match at least one of the provided keywords are retrieved. | |||
| nested | bool | ||
| If set, retrieves all pages below the section or current page recursively. By default, only first-order children are retrieved. | |||
| reverse | bool | true |
|
| Sets the sort order to descending. | |||
| section | string | ||
| Name of the content section. | |||
| sort | select | yes | |
Key to sort by. Supported values: [date, title, weight]. |
|||
| tags | string, slice | ||
| Tags to be used as filter. When set, only pages that match at least one of the provided tags are retrieved. | |||