Datatable
The Datatable component is a versatile component for displaying tabular data. It allows customization of styles, sizes, and densities, providing flexibility to fit various design requirements. The Datatable component utilizes the following subcomponents:
- DatatableHeader: Defines the header section of the datatable.
- DatatableBody: Contains the body rows of the datatable.
- DatatableRow: Used to define individual rows within the datatable.
- DatatableCell: Represents individual cells within a datatable row.
- DatatableNoData: Displayed when there is no data to show in the datatable, including an optional reload button.
Basic example
<QtmDatatable size="medium" marginDensity="medium" arrayStyle="lines">
<QtmDatatableHeader>
<QtmDatatableRow>
<QtmDatatableCell>Title</QtmDatatableCell>
<QtmDatatableCell>Title</QtmDatatableCell>
</QtmDatatableRow>
</QtmDatatableHeader>
<QtmDatatableBody>
<QtmDatatableRow>
<QtmDatatableCell>Data cell</QtmDatatableCell>
<QtmDatatableCell>Data cell</QtmDatatableCell>
</QtmDatatableRow>
<QtmDatatableRow>
<QtmDatatableCell>Data cell</QtmDatatableCell>
<QtmDatatableCell>Data cell</QtmDatatableCell>
</QtmDatatableRow>
<QtmDatatableRow>
<QtmDatatableCell>Data cell</QtmDatatableCell>
<QtmDatatableCell>Data cell</QtmDatatableCell>
</QtmDatatableRow>
</QtmDatatableBody>
</QtmDatatable>
Props
Sizes
Defines the size of the datatable. Options include 'small', 'medium', and 'large'.
<QtmDatatable size="small">...</QtmDatatable>
<QtmDatatable size="medium">...</QtmDatatable>
<QtmDatatable size="large">...</QtmDatatable>
Array style
Determines the style of the datatable. Options include 'flat', 'grid', 'lines', and 'zebras'.
<QtmDatatable arrayStyle="flat">...</QtmDatatable>
<QtmDatatable arrayStyle="grid">...</QtmDatatable>
<QtmDatatable arrayStyle="lines">...</QtmDatatable>
<QtmDatatable arrayStyle="zebras">...</QtmDatatable>
Margin density
Specifies the margin density of the datatable. Options include 'small', 'medium', and 'large'.
<QtmDatatable marginDensity="small">...</QtmDatatable>
<QtmDatatable marginDensity="medium">...</QtmDatatable>
<QtmDatatable marginDensity="large">...</QtmDatatable>
No Data State
<QtmDatatableNoData></QtmDatatableNoData>
No Data State with sizes
<QtmDatatableNoData size='small'/>
<QtmDatatableNoData size='medium'/>
<QtmDatatableNoData size='large'/>
API
QtmDatatable
| Property | Type | Default | Description |
|---|---|---|---|
| arrayStyle | "flat" | "grid" | "lines" | "zebras" | 'lines' | The table style |
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing | |
| marginDensity | "large" | "medium" | "small" | 'medium' | The table margin density |
| size | "large" | "medium" | "small" | 'medium' | The size of child elements( header, body, row, cell) in data table array |
QtmDatatableNoData
| Property | Type | Default | Description |
|---|---|---|---|
| classes | string | list of classes to override or extend the styles applied to the component. You can use available utility classes by importing | |
| size | "large" | "medium" | "small" | 'medium' | The size of child elements |
| Event | Type | Description |
|---|---|---|
| onReload | CustomEvent<void> | Callback fired when the reload button is clicked. |