import { CSmartTable } from '@coreui/react-pro'// orimport CSmartTable from '@coreui/react-pro/src/components/smart-table/CSmartTable'| Property | Description | Type | Default |
|---|---|---|---|
| activePage | Sets active page. If 'pagination' prop is enabled, activePage is set only initially. | number | 1 |
| cleaner | When set, displays table cleaner above table, next to the table filter (or in place of table filter if tableFilter prop is not set)Cleaner resets tableFilterValue, columnFilterValue, sorterValue. If clean is possible it is clickable (tabIndex="0" role="button", color="danger"), otherwise it is not clickable and transparent. Cleaner can be customized through the cleaner slot. | boolean | - |
| clickableRows | Style table items as clickable. | boolean | - |
| columnFilter | When set, displays additional filter row between table header and items, allowing filtering by specific column. Column filter can be customized, by passing prop as object with additional options as keys. Available options: - external (Boolean) - Disables automatic filtering inside component. - lazy (Boolean) - Set to true to trigger filter updates only on change event. | boolean | ColumnFilter | - |
| columnFilterValue | Value of table filter. To set pass object where keys are column names and values are filter strings e.g.:{ user: 'John', age: 12 } | ColumnFilterValue | - |
| columnSorter | Enables table sorting by column value. Sorting will be performed corectly only if values in column are of one type: string (case insensitive) or number. Sorter can be customized, by passing prop as object with additional options as keys. Available options: - external (Boolean) - Disables automatic sorting inside component. - resetable (Boolean) - If set to true clicking on sorter have three states: ascending, descending and null. That means that third click on sorter will reset sorting, and restore table to original order. | boolean | Sorter | - |
| columns | Prop for table columns configuration. If prop is not defined, table will display columns based on the first item keys, omitting keys that begins with underscore (e.g. '_classes') In columns prop each array item represents one column. Item might be specified in two ways: String: each item define column name equal to item value. Object: item is object with following keys available as column configuration: - key (required)(String) - define column name equal to item key. - label (String) - define visible label of column. If not defined, label will be generated automatically based on column name, by converting kebab-case and snake_case to individual words and capitalization of each word. - _classes (String/Array/Object) - adds classes to all cels in column - _style (String/Array/Object) - adds styles to the column header (useful for defining widths) - sorter (Boolean) - disables sorting of the column when set to false - filter (Boolean) - removes filter from column when set to false. | (string | Column)[] | - |
| elementCover 4.9.0+ | ReactNode for passing custom CElementCover content. | ReactNode | - |
| footer | If true Displays table footer, which mirrors table header. (without column filter).Or Array of objects or strings, where each element represents one cell in the table footer. Example items: ['FooterCell', 'FooterCell', 'FooterCell']or [{ label: 'FooterCell', _props: { color: 'success' }, ...] | boolean | (string | FooterItem)[] | - |
| header | Set to false to remove table header. | boolean | true |
| items 4.9.0+ | Array of objects, where each object represents one item - row in table. Additionally, you can add style classes to each row by passing them by '_props' key and to single cell by '_cellProps'. Example item: { name: 'John' , age: 12, _props: { color: 'success' }, _cellProps: { age: { className: 'fw-bold'}}} | Item[] | - |
| itemsNumber | The total number of items. Use if you pass a portion of data from an external source to let know component what is the total number of items. | number | - |
| itemsPerPage | Number of items per site, when pagination is enabled. | number | 10 |
| itemsPerPageLabel | Label for items per page selector. | string | Items per page: |
| itemsPerPageOptions | Items per page selector options. | number[] | [5, 10, 20, 50] |
| itemsPerPageSelect | Adds select element over table, which is used for control items per page in pagination. If you want to customize this element, pass object with optional values: - label (String) - replaces default label text - values (Array) - custom array of pagination values - external (Boolean) - disables automatic 'itemsPerPage' change (use to change pages externaly by 'pagination-change' event). | boolean | ItemsPerPageSelect | - |
| loading | When set, table will have loading style: loading spinner and reduced opacity. | boolean | - |
| noItemsLabel | ReactNode or string for passing custom noItemsLabel texts. | ReactNode | No items found |
| onActivePageChange | Page change callback. | (value: number) => void | - |
| onColumnFilterChange | Column filter change callback. | (value: ColumnFilterValue) => void | - |
| onFilteredItemsChange | Filtered items change callback. | (items: Item[]) => void | - |
| onItemsPerPageChange | Pagination change callback. | (value: number) => void | - |
| onRowClick | Row click callback. | (item: Item, index: number, columnName: string, event: boolean | MouseEvent<Element, MouseEvent>) => void | - |
| onSelectAll 4.9.0+ | Select all callback. | () => void | - |
| onSelectedItemsChange | Selected items change callback. | (items: Item[]) => void | - |
| onSorterChange | Sorter value change callback. | (value: SorterValue) => void | - |
| onTableFilterChange | Table filter change callback. | (value?: string) => void | - |
| pagination | Enables default pagination. Set to true for default setup or pass an object with additional CPagination props. Default pagination will always have the computed number of pages that cannot be changed. The number of pages is generated based on the number of passed items and 'itemsPerPage' prop. If this restriction is an obstacle, you can make external CPagination instead. | boolean | Pagination | - |
| paginationProps | Properties to CSmartPagination component - https://coreui.io/react/docs/components/smart-pagination#csmartpagination | CSmartPaginationProps | - |
| scopedColumns | Scoped columns. | ScopedColumns | - |
| selectAll 4.9.0+ | Enables select all checkbox displayed in the header of the table. Can be customized, by passing prop as object with additional options as keys. Available options: - external (Boolean) - Disables automatic selection inside the component. | boolean | { external?: boolean; } | true |
| selectable | Add checkboxes to make table rows selectable. | boolean | - |
| selected 4.9.0+ | Array of selected objects, where each object represents one item - row in table. Example item: { name: 'John' , age: 12 } | Item[] | - |
| sorterValue | State of the sorter. Name key is column name, direction can be 'asc' or 'desc'. | SorterValue | - |
| sortingIcon | Sorter icon when items are unsorted. | ReactNode | <CIcon width={18} icon={cilSwapVertical} key="csv" /> |
| sortingIconAscending | Sorter icon when items are sorted ascending. | ReactNode | <CIcon width={18} icon={cilArrowTop} key="cat" /> |
| sortingIconDescending | Sorter icon when items are sorted descending. | ReactNode | <CIcon width={18} icon={cilArrowBottom} key="cab" /> |
| tableBodyProps | Properties to CTableBody component - https://coreui.io/react/docs/components/table/#ctablebody | CTableBodyProps | - |
| tableFilter | When set, displays table filter above table, allowing filtering by specific column. Column filter can be customized, by passing prop as object with additional options as keys. Available options: - external (Boolean) - Disables automatic filtering inside component. - lazy (Boolean) - Set to true to trigger filter updates only on change event. | boolean | TableFilter | - |
| tableFilterLabel | The element represents a caption for a component. | string | Filter: |
| tableFilterPlaceholder | Specifies a short hint that is visible in the search input. | string | type string... |
| tableFilterValue | Value of table filter. | string | - |
| tableFootProps | Properties to CTableFoot component - https://coreui.io/react/docs/components/table/#ctablefoot | CTableFootProps | - |
| tableHeadProps | Properties to CTableHead component - https://coreui.io/react/docs/components/table/#ctablehead | CTableHeadProps | - |
| tableProps | Properties to CTable component - https://coreui.io/react/docs/components/table/#ctable | CTableProps | - |
On this page