This feature is not available on mobile when
mobile-cards
.
To show a data table is very simple, you just need a data
and a columns
prop.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
# Sandbox with custom template
To show a custom row template, you should not use the columns
prop, but add it within the scoped slot as a component.
Also you can add an empty
named slot to show when there's no data.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 10/15/2016 | Male |
2 | John | Jacobs | 12/15/2016 | Male |
3 | Tina | Gilbert | 4/26/2016 | Female |
4 | Clarence | Flores | 4/10/2016 | Male |
5 | Anne | Lee | 12/6/2016 | Female |
Total | 2 Females, 3 Males |
# Selection
You can show a single selected row by passing the corresponding object to the selected
prop. Additionally, adding the .sync
modifier will make it two-way binding — selected object will mutate if user clicks on row.
Use focusable
prop make table to be focused and navigable with a keyboard using arrow keys.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
# Checkable
You can add checkboxes to rows by using the checkable
prop.
To show which rows are checked, you have to pass the corresponding object array to the checked-rows
prop. Adding the .sync
modifier will make it two-way binding — checked object array will mutate if user clicks on checkboxes.
A slot called bottom-left
is available whenever the table is checkable or paginated, you can add anything in there.
ID | First Name | Last Name | Date | Gender | |
---|---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male | |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male | |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female | |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male | |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
# Searchable
You can add search filtering to rows by using the searchable
prop.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
You can debounce search filter to avoid multiple filtering when typing.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
You can also customize the search input using a scoped slot.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
# Pagination and sorting
To make a column sortable, add the sortable
prop on it and specify a field
name.
You can also use the default-sort
prop to determine the default sort column and order. The column must be sortable
to work.
The default-sort-direction
prop can be set to determine the default sort column direction on the first click.
A slot called bottom-left
is available whenever the table is checkable or paginated, you can add anything in there.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
30 | Alan | Mendoza | 4/22/2016 | Male |
57 | Alan | Edwards | 3/22/2017 | Male |
20 | Albert | Mendoza | 8/8/2016 | Male |
45 | Andrea | Marshall | 9/4/2016 | Female |
8 | Andrew | Greene | 11/20/2016 | Male |
# Sorting multiple
To sort on additional columns, use sort-multiple
is enabled
Use $refs.YOURREF.resetMultiSorting()
to reset the current multi column sorting
Use sort-multiple-data
prop together with backend-sorting
if you want to use a custom sorting priority
Use sort-multiple-key
prop if you only want to enable multi column sorting when it is in combination with a key. Use value null
to have it always enabled (default if not specified)
First name | Last name | Team |
---|---|---|
Abbie | Archer | Team B |
Abbie | Smith | Team A |
Jones | Smith | Team C |
Abbie | Archer | Team A |
# Detailed rows
You can have detailed rows by adding a detail
named scoped slot and the detailed
prop.
You can also toggle row detail programmatically using toggleDetails
method by ref or by default slot and :show-detail-icon="false"
if you want to hide chevron icon.
# Custom Detailed rows
You can add anything you like into the detail
named scoped by providing the customDetailRow
prop to the table.
# Row status
Use the row-class
prop to return a class name. It's a function that receives row
and index
parameters.
Note that you have to style the class yourself.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
# Custom headers
By adding a scoped slot named header
in table component you can customize the headers. Use the meta
prop on column to pass anything you may need.
Previous scoped slot named header
in table will be deprecated.
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 10/15/2016 | Male |
2 | John | Jacobs | 12/15/2016 | Male |
3 | Tina | Gilbert | 4/26/2016 | Female |
4 | Clarence | Flores | 4/10/2016 | Male |
5 | Anne | Lee | 12/6/2016 | Female |
# Subheadings
Use the subheading
prop on columns to add subheadings. This is particularly useful to display a summary when dealing with long tables.
By adding a scoped slot named subheading
in table component you can customize the subheadings.
ID | Contributor | Posts | Comments |
---|---|---|---|
Total: | 18 | 60 | |
1 | Jesse Simmons | 2 | 5 |
2 | John Jacobs | 11 | 42 |
3 | Tina Gilbert | 0 | 7 |
4 | Clarence Flores | 4 | 4 |
5 | Anne Lee | 1 | 2 |
# Sticky Headers and Columns
Use the sticky-header
prop to show a scrolling table with fixed headers.
Use the sticky
prop on column to show a scrolling table with a fixed column.
The default height is 300px
but you can overwrite it using height
prop or $table-sticky-header-height
Sass variable.
ID | First Name | Last Name | Date | Gender | Column A | Column B | Column C | Column D | Column E | Column F | Column G | Column H | Column I | Column L | Column M | Column N | Column O |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Jesse | Simmons | 2016/10/15 13:43:27 | Male | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
2 | John | Jacobs | 2016/12/15 06:00:53 | Male | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
3 | Tina | Gilbert | 2016/04/26 06:26:28 | Female | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
4 | Clarence | Flores | 2016/04/10 10:28:46 | Male | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
5 | Anne | Lee | 2016/12/06 14:38:38 | Female | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 |
6 | Sara | Armstrong | 2016/09/23 18:50:04 | Female | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 |
7 | Anthony | Webb | 2016/08/30 23:49:38 | Male | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 |
8 | Andrew | Greene | 2016/11/20 14:57:47 | Male | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 |
9 | Russell | White | 2016/07/13 09:29:49 | Male | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 |
10 | Lori | Hunter | 2016/12/09 01:44:05 | Female | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 |
checkable
and sticky-checkbox
to make a sticky checkbox column. ID | First Name | Last Name | Date | Gender | Column A | Column B | Column C | Column D | Column E | Column F | Column G | Column H | Column I | Column L | Column M | Column N | Column O | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Jesse | Simmons | 2016/10/15 13:43:27 | Male | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |
2 | John | Jacobs | 2016/12/15 06:00:53 | Male | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | |
3 | Tina | Gilbert | 2016/04/26 06:26:28 | Female | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | |
4 | Clarence | Flores | 2016/04/10 10:28:46 | Male | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | |
5 | Anne | Lee | 2016/12/06 14:38:38 | Female | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | |
6 | Sara | Armstrong | 2016/09/23 18:50:04 | Female | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | |
7 | Anthony | Webb | 2016/08/30 23:49:38 | Male | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | |
8 | Andrew | Greene | 2016/11/20 14:57:47 | Male | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | |
9 | Russell | White | 2016/07/13 09:29:49 | Male | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | |
10 | Lori | Hunter | 2016/12/09 01:44:05 | Female | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 |
# Toggle columns
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 10/15/2016 | Male |
2 | John | Jacobs | 12/15/2016 | Male |
3 | Tina | Gilbert | 4/26/2016 | Female |
4 | Clarence | Flores | 4/10/2016 | Male |
5 | Anne | Lee | 12/6/2016 | Female |
Footer |
# Async data
Use backend-sorting
and backend-pagination
props to let those tasks to the backend, then manage it with page-change
and sort
events.
API from TMDb.
Title | Vote Average | Vote Count | Release Date | Overview |
---|---|---|---|---|
Inception | 8.367 | 35553 | 7/15/2010 | Cobb, a skilled thief who commits corporate espionage by infiltrating the subcon... |
Interstellar | 8.433 | 34084 | 11/5/2014 | The adventures of a group of explorers who make use of a newly discovered wormho... |
The Dark Knight | 8.515 | 31771 | 7/16/2008 | Batman raises the stakes in his war on crime. With the help of Lt. Jim Gordon an... |
Avatar | 7.581 | 30729 | 12/15/2009 | In the 22nd century, a paraplegic Marine is dispatched to the moon Pandora on a ... |
The Avengers | 7.714 | 29934 | 4/25/2012 | When an unexpected enemy emerges and threatens global safety and security, Nick ... |
Deadpool | 7.611 | 29735 | 2/9/2016 | The origin story of former Special Forces operative turned mercenary Wade Wilson... |
Avengers: Infinity War | 8.248 | 28757 | 4/25/2018 | As the Avengers and their allies have continued to protect the world from threat... |
Fight Club | 8.441 | 28361 | 10/15/1999 | A ticking-time-bomb insomniac and a slippery soap salesman channel primal male a... |
Guardians of the Galaxy | 7.908 | 27332 | 7/30/2014 | Light years from Earth, 26 years after being abducted, Peter Quill finds himself... |
Pulp Fiction | 8.5 | 26939 | 9/10/1994 | A burger-loving hit man, his philosophical partner, a drug-addled gangster's mol... |
Forrest Gump | 8.475 | 26463 | 6/23/1994 | A man with a low IQ has accomplished great things in his life and been present d... |
Harry Potter and the Philosopher's Stone | 7.913 | 26434 | 11/16/2001 | Harry Potter has lived under the stairs at his aunt and uncle's house his whole ... |
The Shawshank Redemption | 8.704 | 25989 | 9/23/1994 | Framed in the 1940s for the double murder of his wife and her lover, upstanding ... |
Iron Man | 7.643 | 25638 | 4/30/2008 | After being held captive in an Afghan cave, billionaire engineer Tony Stark crea... |
Django Unchained | 8.178 | 25479 | 12/25/2012 | With the help of a German bounty hunter, a freed slave sets out to rescue his wi... |
Avengers: Endgame | 8.256 | 24746 | 4/24/2019 | After the devastating events of Avengers: Infinity War, the universe is in ruins... |
The Matrix | 8.214 | 24728 | 3/31/1999 | Set in the 22nd century, The Matrix tells the story of a computer hacker who joi... |
Titanic | 7.905 | 24521 | 11/18/1997 | 101-year-old Rose DeWitt Bukater tells the story of her life aboard the Titanic,... |
Joker | 8.162 | 24406 | 10/1/2019 | During the 1980s, a failed stand-up comedian is driven insane and turns to a lif... |
The Lord of the Rings: The Fellowship of the Ring | 8.412 | 24215 | 12/18/2001 | Young hobbit Frodo Baggins, after inheriting a mysterious ring from his uncle Bi... |
# Draggable rows/columns
Use draggable
/draggable-column
prop to allow rows and columns to be draggable. Manage dragging using dragstart
/columndragstart
, dragover
/columndragover
and drop
/columndrop
events
ID | First Name | Last Name | Date | Gender |
---|---|---|---|---|
1 | Jesse | Simmons | 2016-10-15 13:43:27 | Male |
2 | John | Jacobs | 2016-12-15 06:00:53 | Male |
3 | Tina | Gilbert | 2016-04-26 06:26:28 | Female |
4 | Clarence | Flores | 2016-04-10 10:28:46 | Male |
5 | Anne | Lee | 2016-12-06 14:38:38 | Female |
Name | Description | Type | Values | Default |
---|---|---|---|---|
data | Table data | Array | — | — |
columns | Table columns | Array | — | — |
default-sort | Sets the default sort column and order — e.g. ['first_name', 'desc'] | String, Array | — | order: default-sort-direction prop |
default-sort-direction | Sets the default sort column direction on the first click | String | asc , desc | asc |
sort-icon | Sets the header sorting icon | String | - | arrow-up |
sort-icon-size | Sets the size of the sorting icon | String | is-small , , is-medium , is-large | is-small |
bordered | Border to all cells | Boolean | — | false |
striped | Whether table is striped | Boolean | — | false |
narrowed | Makes the cells narrower | Boolean | — | false |
selected | Set which row is selected, use the .sync modifier to make it two-way binding | Object | — | — |
focusable | Table can be focused and user can navigate with keyboard arrows (require selected.sync ) and rows are highlighted when hovering | Boolean | — | false |
hoverable | Rows are highlighted when hovering | Boolean | — | false |
checkable | Rows can be checked (multiple), checked rows will have a .is-checked class if you want to style | Boolean | — | false |
checkbox-position | Position of the checkbox (if checkable is true) | String | left or right | left |
sticky-checkbox | Make the checkbox column sticky when checkable | Boolean | — | false |
checked-rows | Set which rows are checked, use the .sync modifier to make it two-way binding | Array | — | — |
header-checkable | Show check/uncheck all checkbox in table header when checkable | Boolean | — | true |
checkbox-type | Type (color) of the checkbox when checkable , optional | String | is-white , is-black , is-light ,
is-dark , is-primary , is-info , is-success ,
is-warning , is-danger ,
and any other colors you've set in the $colors list on Sass | is-primary |
mobile-cards | Rows appears as cards on mobile (collapse rows) | Boolean | — | true |
backend-sorting | Columns won't be sorted with Javascript, use with sort event to sort in your backend | Boolean | — | false |
backend-pagination | Rows won't be paginated with Javascript, use with page-change event to paginate in your backend | Boolean | — | false |
total | Total number of table data if backend-pagination is enabled | Number | — | 0 |
current-page | Current page of table data (if paginated ) | Number | — | 1 |
loading | Loading state | Boolean | — | false |
paginated | Adds pagination to the table | Boolean | — | false |
pagination-simple | Simple pagination (if paginated ) | Boolean | — | false |
pagination-rounded | Rounded pagination (if paginated ) | Boolean | — | false |
pagination-order | Buttons order, optional | String | is-centered , is-right | — |
pagination-size | Pagination size (if paginated ) | String | is-small , is-medium , is-large | — |
pagination-position | Pagination position (if paginated ) | String | bottom , top , both | bottom |
per-page | How many rows per page (if paginated ) | Number | — | 20 |
page-input | Include page number input. | Boolean | — | false |
page-input-position | Page input position. | String | is-input-right , is-input-left | — |
debounce-page-input | Sets the page input debounce time (in milliseconds) | Number | — | — |
sort-multiple | Adds multiple column sorting | Boolean | — | false |
sort-multiple-data | Used in combination with backend-sorting | Object | [{field, order}] | [] |
sort-multiple-key | Adds a key which will be required for multi column sorting to work. Will always be enabled if null is selected (default). Requires sort-multiple | String | null , shiftKey , altKey , ctrlKey | null |
row-class | Add a class to row (<tr> element) based on the return | Function (row: Object, index: Number) | — | — |
detailed | Allow row details (check scoped slots documentation) | Boolean | — | false |
custom-detail-row | Allow a custom detail row | Boolean | — | false |
show-detail-icon | Allow chevron icon and column to be visible | Boolean | — | true |
detail-icon | Icon name | String | — | chevron-right |
opened-detailed | Allow pre-defined opened details. Ideal to open details via vue-router. (A unique key is required; check detail-key prop) | Array | — | [] |
has-detailed-visible | Controls the visibility of the trigger that toggles the detailed rows. | Function (row: Object) | — | true |
detail-key | Use a unique key of your data Object when use detailed or opened detailed. (id recommended) | String | — | — |
detail-transition | Transition name to use when toggling row details. | String | — | — |
custom-is-checked | Custom method to verify if row is checked, works when is checkable . Useful for backend pagination | Function (a: Object, b: Object) | — | — |
is-row-checkable | Custom method to verify if a row is checkable, works when is checkable . | Function (row: Object) | — | true |
is-row-selectable | Custom method to verify if a row is selectable, works when is selected . | Function (row: Object) | — | true |
icon-pack | Icon pack to use | String | mdi , fa , fas , far , fad , fal | mdi |
mobile-sort-placeholder | Text when nothing is selected | String | — | — |
custom-row-key | Use a unique key of your data Object for each row. Useful if your data prop has dynamic indices. (id recommended) | String | - | - |
draggable | Allows rows to be draggable | Boolean | — | false |
draggable-column | Allows columns to be draggable | Boolean | — | false |
backend-filtering | Columns won't be filtered with Javascript, use with searchable prop to the columns to filter in your backend | Boolean | — | false |
sticky-header | Show a sticky table header | Boolean | — | false |
scrollable | Add a horizontal scrollbar when table is too wide | Boolean | — | false |
height | Table fixed height in pixels | Number, String | — | — |
filters-event | Add a native event to filter | String | — | — |
card-layout | Rows appears as cards (collapse rows) | Boolean | — | false |
show-header | Show table column header | Boolean | — | true |
aria-next-label | Accessibility label for the next page link (if paginated ) | String | — | — |
aria-previous-label | Accessibility label for the previous page link (if paginated ) | String | — | — |
aria-page-label | Accessibility label for the page link. If passed, this text will be prepended to the number of the page (if paginated ) | String | — | — |
aria-current-label | Accessibility label for the current page link. If passed, this text will be prepended to the current page (if paginated ) | String | — | — |
debounce-search | Sets the filtering debounce time (in milliseconds) | Number | — | — |
Name | Description | Type | Values | Default |
---|---|---|---|---|
label | Column header text, also used to identify column if custom-key prop is missing | String | — | — |
custom-key | Unique identifier, use when label is missing or there are duplicate label names | String, Number | — | this.label |
field | Property of the object the column is attributed, used for sorting | String | — | — |
meta | Meta prop to add anything, useful when creating custom headers | Any | — | — |
width | Column fixed width in any unit, or pixels when none is provided | Number, String | — | — |
numeric | Align the cell content to the right, sort icon on left | Boolean | — | false |
centered | Align the cell content to the center | Boolean | — | false |
sortable | Whether the column can be sorted | Boolean | — | false |
visible | Whether the column is visible | Boolean | — | true |
custom-sort | Custom sort method, works when column is sortable | Function (a: Object, b: Object, isAsc: Boolean) | — | — |
searchable | Add a input below the header to filter data | Boolean | — | false |
custom-search | Custom search method, works when column is searchable | Function (a: Object, input: String) | — | — |
subheading | Column subheading text | String, Number | — | — |
sticky | Show a sticky column | Boolean | — | false |
header-selectable | Whether the header text is selectable, works when column is sortable . | Boolean | — | false |
header-class | CSS classes to be applied on header | String | — | - |
cell-class | CSS classes to be applied on cell | String | — | - |
th-attrs | Adds native attributes to th :th-attrs="(column)" => ({})" | Function | — | - |
td-attrs | Adds native attributes to td :td-attrs="(row, column)" => ({})" | Function | — | - |
You can use these variables to customize this component.
Name | Default |
---|---|
$table-sticky-header-height | 300px |
Bulma variables | Link |
This page is open source. Noticed a typo or something's unclear?