@iress-oss/ids-mcp-server 5.15.0 → 5.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/generated/docs/components_components-alert-docs.md +496 -0
  2. package/generated/docs/components_components-autocomplete-docs.md +3429 -0
  3. package/generated/docs/{components-autocomplete-recipes-docs.md → components_components-autocomplete-recipes-docs.md} +39 -14
  4. package/generated/docs/{components-badge-docs.md → components_components-badge-docs.md} +222 -30
  5. package/generated/docs/components_components-button-docs.md +2078 -0
  6. package/generated/docs/components_components-button-recipes-docs.md +37 -0
  7. package/generated/docs/components_components-buttongroup-docs.md +1045 -0
  8. package/generated/docs/components_components-card-docs.md +2290 -0
  9. package/generated/docs/{components-card-recipes-docs.md → components_components-card-recipes-docs.md} +132 -15
  10. package/generated/docs/components_components-checkbox-docs.md +1040 -0
  11. package/generated/docs/{components-checkboxgroup-docs.md → components_components-checkboxgroup-docs.md} +1001 -82
  12. package/generated/docs/{components-checkboxgroup-recipes-docs.md → components_components-checkboxgroup-recipes-docs.md} +102 -12
  13. package/generated/docs/{components-col-docs.md → components_components-col-docs.md} +331 -58
  14. package/generated/docs/components_components-combobox-docs.md +3735 -0
  15. package/generated/docs/{components-container-docs.md → components_components-container-docs.md} +61 -24
  16. package/generated/docs/{components-divider-docs.md → components_components-divider-docs.md} +83 -24
  17. package/generated/docs/{components-expander-docs.md → components_components-expander-docs.md} +266 -33
  18. package/generated/docs/components_components-field-docs.md +1369 -0
  19. package/generated/docs/components_components-filter-docs.md +4080 -0
  20. package/generated/docs/{components-form-docs.md → components_components-form-docs.md} +1556 -360
  21. package/generated/docs/{components-form-recipes-docs.md → components_components-form-recipes-docs.md} +277 -60
  22. package/generated/docs/{components-hide-docs.md → components_components-hide-docs.md} +195 -124
  23. package/generated/docs/components_components-icon-docs.md +1337 -0
  24. package/generated/docs/{components-inline-docs.md → components_components-inline-docs.md} +462 -42
  25. package/generated/docs/components_components-input-docs.md +1468 -0
  26. package/generated/docs/components_components-input-recipes-docs.md +367 -0
  27. package/generated/docs/components_components-inputcurrency-docs.md +432 -0
  28. package/generated/docs/{components-inputcurrency-recipes-docs.md → components_components-inputcurrency-recipes-docs.md} +113 -17
  29. package/generated/docs/components_components-label-docs.md +323 -0
  30. package/generated/docs/components_components-menu-docs.md +2345 -0
  31. package/generated/docs/components_components-menu-menuitem-docs.md +633 -0
  32. package/generated/docs/{components-modal-docs.md → components_components-modal-docs.md} +1640 -231
  33. package/generated/docs/components_components-navbar-docs.md +1847 -0
  34. package/generated/docs/{components-navbar-recipes-docs.md → components_components-navbar-recipes-docs.md} +721 -40
  35. package/generated/docs/{components-panel-docs.md → components_components-panel-docs.md} +754 -57
  36. package/generated/docs/components_components-placeholder-docs.md +92 -0
  37. package/generated/docs/components_components-popover-docs.md +1643 -0
  38. package/generated/docs/components_components-popover-recipes-docs.md +491 -0
  39. package/generated/docs/components_components-progress-docs.md +115 -0
  40. package/generated/docs/{components-provider-docs.md → components_components-provider-docs.md} +42 -33
  41. package/generated/docs/components_components-radio-docs.md +491 -0
  42. package/generated/docs/{components-radiogroup-docs.md → components_components-radiogroup-docs.md} +927 -75
  43. package/generated/docs/components_components-readonly-docs.md +263 -0
  44. package/generated/docs/components_components-richselect-docs.md +6521 -0
  45. package/generated/docs/{components-row-docs.md → components_components-row-docs.md} +353 -43
  46. package/generated/docs/{components-select-docs.md → components_components-select-docs.md} +719 -61
  47. package/generated/docs/components_components-skeleton-docs.md +480 -0
  48. package/generated/docs/{components-skeleton-recipes-docs.md → components_components-skeleton-recipes-docs.md} +51 -11
  49. package/generated/docs/{components-skiplink-docs.md → components_components-skiplink-docs.md} +53 -14
  50. package/generated/docs/components_components-slideout-docs.md +2293 -0
  51. package/generated/docs/components_components-slider-docs.md +1276 -0
  52. package/generated/docs/components_components-spinner-docs.md +82 -0
  53. package/generated/docs/{components-stack-docs.md → components_components-stack-docs.md} +223 -40
  54. package/generated/docs/components_components-table-docs.md +3658 -0
  55. package/generated/docs/components_components-tabset-docs.md +772 -0
  56. package/generated/docs/components_components-tabset-tab-docs.md +262 -0
  57. package/generated/docs/components_components-tag-docs.md +257 -0
  58. package/generated/docs/{components-text-docs.md → components_components-text-docs.md} +491 -51
  59. package/generated/docs/{components-toaster-docs.md → components_components-toaster-docs.md} +187 -85
  60. package/generated/docs/components_components-toaster-toast-docs.md +634 -0
  61. package/generated/docs/components_components-toggle-docs.md +461 -0
  62. package/generated/docs/{components-tooltip-docs.md → components_components-tooltip-docs.md} +286 -41
  63. package/generated/docs/{components-validationmessage-docs.md → components_components-validationmessage-docs.md} +230 -61
  64. package/generated/docs/components_contact-us-docs.md +12 -0
  65. package/generated/docs/{foundations-accessibility-docs.md → components_foundations-accessibility-docs.md} +11 -21
  66. package/generated/docs/{foundations-colours-docs.md → components_foundations-colour-030-colours.md} +8 -15
  67. package/generated/docs/{foundations-consistency-docs.md → components_foundations-consistency-docs.md} +12 -20
  68. package/generated/docs/{foundations-content-docs.md → components_foundations-content-docs.md} +6 -11
  69. package/generated/docs/components_foundations-introduction-docs.md +15 -0
  70. package/generated/docs/{foundations-principles-docs.md → components_foundations-principles-docs.md} +14 -24
  71. package/generated/docs/components_foundations-typography-docs.md +608 -0
  72. package/generated/docs/{foundations-user-experience-docs.md → components_foundations-user-experience-docs.md} +16 -26
  73. package/generated/docs/{foundations-visual-design-docs.md → components_foundations-visual-design-docs.md} +10 -17
  74. package/generated/docs/{frequently-asked-questions-docs.md → components_frequently-asked-questions-docs.md} +14 -23
  75. package/generated/docs/components_get-started-develop-docs.md +84 -0
  76. package/generated/docs/components_get-started-using-storybook-docs.md +55 -0
  77. package/generated/docs/components_introduction-docs.md +15 -0
  78. package/generated/docs/{patterns-loading-docs.md → components_patterns-loading-docs.md} +798 -153
  79. package/generated/docs/components_resources-changelog-docs.md +4 -0
  80. package/generated/docs/{resources-code-katas-docs.md → components_resources-code-katas-docs.md} +5 -9
  81. package/generated/docs/{resources-migration-guides-from-v4-to-v5-docs.md → components_resources-migration-guides-from-v4-to-v5-docs.md} +54 -239
  82. package/generated/docs/components_sandbox-docs.md +4 -0
  83. package/generated/docs/{versions-docs.md → components_versions-docs.md} +5 -8
  84. package/generated/docs/guidelines.md +484 -200
  85. package/generated/docs/introduction-docs.md +19 -30
  86. package/package.json +41 -45
  87. package/generated/docs/components-alert-docs.md +0 -130
  88. package/generated/docs/components-autocomplete-docs.md +0 -754
  89. package/generated/docs/components-button-docs.md +0 -362
  90. package/generated/docs/components-button-recipes-docs.md +0 -76
  91. package/generated/docs/components-buttongroup-docs.md +0 -310
  92. package/generated/docs/components-card-docs.md +0 -494
  93. package/generated/docs/components-checkbox-docs.md +0 -193
  94. package/generated/docs/components-combobox-docs.md +0 -1016
  95. package/generated/docs/components-field-docs.md +0 -675
  96. package/generated/docs/components-filter-docs.md +0 -1109
  97. package/generated/docs/components-icon-docs.md +0 -553
  98. package/generated/docs/components-input-docs.md +0 -335
  99. package/generated/docs/components-input-recipes-docs.md +0 -140
  100. package/generated/docs/components-inputcurrency-docs.md +0 -157
  101. package/generated/docs/components-label-docs.md +0 -135
  102. package/generated/docs/components-menu-docs.md +0 -704
  103. package/generated/docs/components-menu-menuitem-docs.md +0 -193
  104. package/generated/docs/components-navbar-docs.md +0 -291
  105. package/generated/docs/components-placeholder-docs.md +0 -27
  106. package/generated/docs/components-popover-docs.md +0 -464
  107. package/generated/docs/components-popover-recipes-docs.md +0 -245
  108. package/generated/docs/components-progress-docs.md +0 -104
  109. package/generated/docs/components-radio-docs.md +0 -107
  110. package/generated/docs/components-readonly-docs.md +0 -89
  111. package/generated/docs/components-richselect-docs.md +0 -2433
  112. package/generated/docs/components-skeleton-docs.md +0 -214
  113. package/generated/docs/components-slideout-docs.md +0 -538
  114. package/generated/docs/components-slider-docs.md +0 -346
  115. package/generated/docs/components-spinner-docs.md +0 -59
  116. package/generated/docs/components-table-ag-grid-docs.md +0 -1074
  117. package/generated/docs/components-table-docs.md +0 -1305
  118. package/generated/docs/components-tabset-docs.md +0 -341
  119. package/generated/docs/components-tabset-tab-docs.md +0 -86
  120. package/generated/docs/components-tag-docs.md +0 -115
  121. package/generated/docs/components-toaster-toast-docs.md +0 -157
  122. package/generated/docs/components-toggle-docs.md +0 -158
  123. package/generated/docs/contact-us-docs.md +0 -27
  124. package/generated/docs/extensions-editor-docs.md +0 -288
  125. package/generated/docs/extensions-editor-recipes-docs.md +0 -39
  126. package/generated/docs/foundations-introduction-docs.md +0 -17
  127. package/generated/docs/foundations-typography-docs.md +0 -191
  128. package/generated/docs/get-started-develop-docs.md +0 -209
  129. package/generated/docs/get-started-using-storybook-docs.md +0 -68
  130. package/generated/docs/resources-changelog-docs.md +0 -6
  131. package/generated/docs/themes-available-themes-docs.md +0 -66
  132. package/generated/docs/themes-introduction-docs.md +0 -121
  133. package/generated/docs/themes-tokens-docs.md +0 -1200
  134. /package/{LICENSE.txt → LICENSE} +0 -0
@@ -1,1305 +0,0 @@
1
- [](#table)Table
2
- ===============
3
-
4
- Overview
5
- --------
6
-
7
- Data driven component for displaying tabular data.
8
-
9
- My investments
10
- | Investment Name | Cost | Investment Date | Total Percentage |
11
- | --- | --- | --- | --- |
12
- | Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
13
- | CASH.CASH | 49751.4 | 2020-06-28 | 49 |
14
- | VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
15
-
16
- Hide code
17
-
18
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
19
-
20
- <IressTable
21
- caption\="My investments"
22
- rows\={\[
23
- {
24
- cost: 23898,
25
- investmentDate: '2019-09-23',
26
- investment\_name: 'Artemis Fund Managers Limited',
27
- totalPercentage: 24.8
28
- },
29
- {
30
- cost: 49751.4,
31
- investmentDate: '2020-06-28',
32
- investment\_name: 'CASH.CASH',
33
- totalPercentage: 49
34
- },
35
- {
36
- cost: 26382.456,
37
- investmentDate: '2019-02-05',
38
- investment\_name: 'VODAFONE GRP',
39
- totalPercentage: 26.2
40
- }
41
- \]}
42
- />
43
-
44
- Copy
45
-
46
- [](#usage)Usage
47
- ---------------
48
-
49
- ### [](#automatic-columns)Automatic columns
50
-
51
- To get started, the `IressTable` component only requires the `caption` and `rows` props to be set.
52
-
53
- * `caption` a string describing what the table is displaying (required for accessibility, it can be visually hidden by setting the `hiddenCaption` prop).
54
- * `rows` are an array of objects, each object represents a row in the table. The table will use the key of the first object to determine the columns, automatically made human readable if the key is camel case, snake case or kebab case.
55
-
56
- My investments
57
- | Investment Name | Cost | Investment Date | Total Percentage |
58
- | --- | --- | --- | --- |
59
- | Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
60
- | CASH.CASH | 49751.4 | 2020-06-28 | 49 |
61
- | VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
62
-
63
- Hide code
64
-
65
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
66
-
67
- <IressTable
68
- caption\="My investments"
69
- rows\={\[
70
- {
71
- cost: 23898,
72
- investmentDate: '2019-09-23',
73
- investment\_name: 'Artemis Fund Managers Limited',
74
- totalPercentage: 24.8
75
- },
76
- {
77
- cost: 49751.4,
78
- investmentDate: '2020-06-28',
79
- investment\_name: 'CASH.CASH',
80
- totalPercentage: 49
81
- },
82
- {
83
- cost: 26382.456,
84
- investmentDate: '2019-02-05',
85
- investment\_name: 'VODAFONE GRP',
86
- totalPercentage: 26.2
87
- }
88
- \]}
89
- />
90
-
91
- Copy
92
-
93
- ### [](#custom-columns)Custom columns
94
-
95
- For more control over the columns, the `columns` prop can be used to define the columns. This accepts an array of `TableColumn` objects.
96
-
97
- Each array item represents a key in the objects in your `rows` prop. If one of the keys in your `rows` prop is not defined in the `columns` prop, it will not be displayed in the table.
98
-
99
- My investments
100
- | Investment | Date | Share | Cost |
101
- | --- | --- | --- | --- |
102
- | Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 |
103
- | CASH.CASH | 28/06/2020 | 49% | $49,751.40 |
104
- | VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 |
105
-
106
- Hide code
107
-
108
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
109
-
110
- import {
111
- IressBadge,
112
- IressTable,
113
- IressTableFormattedValue,
114
- IressTableProps,
115
- } from '@iress-oss/ids-components';
116
- type Props \= Partial<IressTableProps<object, never\>>;
117
- const renderColumn \= (value: number) \=> (
118
- <IressBadge mode\={value \> 30000 ? 'success' : 'danger'}\>
119
- <IressTableFormattedValue value\={value} format\="currency" />
120
- </IressBadge\>
121
- );
122
- export const TableCustomColumns \= () \=> (
123
- <IressTable
124
- caption\="My investments"
125
- rows\={\[
126
- {
127
- investment\_name: 'Artemis Fund Managers Limited',
128
- cost: 23898,
129
- investmentDate: '2019-09-23',
130
- totalPercentage: 24.8,
131
- },
132
- {
133
- investment\_name: 'CASH.CASH',
134
- cost: 49751.4,
135
- investmentDate: '2020-06-28',
136
- totalPercentage: 49,
137
- },
138
- {
139
- investment\_name: 'VODAFONE GRP',
140
- cost: 26382.456,
141
- investmentDate: '2019-02-05',
142
- totalPercentage: 26.2,
143
- },
144
- \]}
145
-
146
- columns\={\[
147
- {
148
- key: 'investment\_name',
149
- label: 'Investment',
150
- divider: true,
151
- },
152
- {
153
- key: 'investmentDate',
154
- label: 'Date',
155
- format: 'date',
156
- },
157
- {
158
- key: 'totalPercentage',
159
- label: 'Share',
160
- format: 'percent',
161
- },
162
- {
163
- key: 'cost',
164
- label: 'Cost',
165
- align: 'right',
166
- format: renderColumn,
167
- },
168
- \]}
169
- />
170
- );
171
-
172
- Copy
173
-
174
- ### [](#column-api)Column API
175
-
176
- These are the configuration options available for each column.
177
-
178
- **Note:** The `id` prop has been removed. The `key` is always used for the id of the table cell, alongside its row index.
179
-
180
- \[data-radix-scroll-area-viewport\] {
181
- scrollbar-width: none;
182
- -ms-overflow-style: none;
183
- -webkit-overflow-scrolling: touch;
184
- }
185
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
186
- display: none;
187
- }
188
- :where(\[data-radix-scroll-area-viewport\]) {
189
- display: flex;
190
- flex-direction: column;
191
- align-items: stretch;
192
- }
193
- :where(\[data-radix-scroll-area-content\]) {
194
- flex-grow: 1;
195
- }
196
-
197
- export interface TableColumn<TRow extends object, TVal \= unknown\> {
198
- /\*\*
199
- \* Aligns the content of the cell. \* @default left \*/
200
- align?: TableColumnAligns;
201
- /\*\*
202
- \* The currency code to prefix to the value if \`format\` is set to currency. \* @default $ \*/
203
- currencyCode?: string;
204
- /\*\*
205
- \* When set to true, a divider will be rendered after the column. \*/
206
- divider?: boolean;
207
- /\*\*
208
- \* Formats the cell content. \* To use the in-built formatters, set this to: string, number, date, currency, percent. \* Use a custom formatter by passing a function that returns a ReactNode. \*/
209
- format?: TableCellFormats | ((value: TVal, row?: TRow) \=> ReactNode);
210
- /\*\*
211
- \* The unique key for the column. \*/
212
- key: string;
213
- /\*\*
214
- \* The label for the column header. \*/
215
- label?: ReactNode;
216
- /\*\*
217
- \* When set to true, the column will be sortable. \* Setting it to either \`asc\` or \`desc\` will set the initial sort order. \*/
218
- sort?: boolean | SortDirection;
219
- /\*\*
220
- \* Text to be read by a screen reader when a column is sortable (but not currently sorted). \* @default sortable \*/
221
- sortableText?: string;
222
- /\*\*
223
- \* The width of the column. \*/
224
- width?: string;
225
- }
226
-
227
- Copy
228
-
229
- [](#examples)Examples
230
- ---------------------
231
-
232
- ### [](#formats)Formats
233
-
234
- The table component provides some basic formatting. This is controlled by the `format` property of the `TableColumn` object.
235
-
236
- * `date`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as DD/MM/YYYY.
237
- * `currency`: the value (which should be a number or a string containing a number) is formatted with the `currencyCode` (also a prop on `TableColumn` which defaults to `$`) prepended to the number (formatted to 2 decimal places). Currency formatted columns are automatically right aligned for readability.
238
- * `percent`: the value (which should be a number or a string containing a number) is formatted as a percentage (multiplied by 100 and rounded to 2 decimal places).
239
- * `number`: the number format aligns the number to the right, and converts strings to a number.
240
- * `shortDate`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as DD MMM YYYY.
241
- * `isoDateTime`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as YYYY-MM-DD HH:mm:ss (Timezone)
242
- * `relativeTime`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as a relative time (eg. 2 days ago, 3 hours ago, etc). It will fallback to the `shortDate` format if the date is more than one week in the past.
243
-
244
- To completely customise it, you can also send in a function that returns a ReactNode. It has two parameters, the original value and the row it is connected to.
245
-
246
- Available formats
247
- | String | Number | Date | Short date | ISO Date & Time | Relative time | Currency (AUD) | Percent | Custom |
248
- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
249
- | Hello, world! | 123456 | 28/06/2020 | 28 Jun 2020 | 2020-06-28 00:00:00 (UTC) | 21 seconds ago | 123,456.78 | 12% | Custom |
250
-
251
- Hide code
252
-
253
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
254
-
255
- import { IressBadge, IressTable, IressTableProps } from '@iress-oss/ids-components';
256
- type Props \= Partial<IressTableProps<object, never\>>;
257
- const renderColumn \= (value: string) \=> (
258
- <IressBadge mode\="info"\>{value}</IressBadge\>
259
- );
260
- // https://blog.devgenius.io/javascript-date-subtract-seconds-83b3285b7959
261
- const subtractSeconds \= (date: Date, seconds: number) \=> {
262
- // make copy with Date() constructor
263
- const dateCopy \= new Date(date);
264
- dateCopy.setSeconds(date.getSeconds() \- seconds);
265
- return dateCopy;
266
- };
267
- const tenSecondsAgo \= subtractSeconds(new Date(), 10);
268
- export const TableFormats \= () \=> (
269
- <IressTable
270
- caption\="Available formats"
271
- rows\={\[
272
- {
273
- string: 'Hello, world!',
274
- number: 123456,
275
- date: '2020-06-28',
276
- shortDate: '2020-06-28',
277
- isoDateTime: '2020-06-28',
278
- relativeTime: tenSecondsAgo,
279
- currency: 123456.78,
280
- percent: 12,
281
- custom: 'Custom',
282
- },
283
- \]}
284
-
285
- columns\={\[
286
- { key: 'string', label: 'String', format: 'string' },
287
- { key: 'number', label: 'Number', format: 'number' },
288
- { key: 'date', label: 'Date', format: 'date' },
289
- { key: 'shortDate', label: 'Short date', format: 'shortDate' },
290
- { key: 'isoDateTime', label: 'ISO Date & Time', format: 'isoDateTime' },
291
- { key: 'relativeTime', label: 'Relative time', format: 'relativeTime' },
292
- {
293
- key: 'currency',
294
- label: 'Currency (AUD)',
295
- format: 'currency',
296
- currencyCode: '',
297
- },
298
- { key: 'percent', label: 'Percent', format: 'percent' },
299
- {
300
- key: 'custom',
301
- label: 'Custom',
302
- format: renderColumn,
303
- },
304
- \]}
305
- />
306
- );
307
-
308
- Copy
309
-
310
- ### [](#sorting)Sorting
311
-
312
- Sorting can be enabled on a column by setting the `sort` property of the `TableColumn` to true. It can also be set to `asc` or `desc` if you would like it to initally sort in a certain direction.
313
-
314
- The sort button has some visually hidden text for screenreaders to signify that the column is sortable. If you need to change this (ie. for translation purposes), it can be done with the `sortableText` column option which defaults to: sortable.
315
-
316
- My investments
317
- | Investment | Date | Share | Cost |
318
- | --- | --- | --- | --- |
319
- | Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 |
320
- | CASH.CASH | 28/06/2020 | 49% | $49,751.40 |
321
- | VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 |
322
-
323
- Hide code
324
-
325
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
326
-
327
- import {
328
- IressBadge,
329
- IressTable,
330
- IressTableFormattedValue,
331
- IressTableProps,
332
- } from '@iress-oss/ids-components';
333
- type Props \= Partial<IressTableProps<object, never\>>;
334
- const renderColumn \= (value: number) \=> (
335
- <IressBadge mode\={value \> 30000 ? 'success' : 'danger'}\>
336
- <IressTableFormattedValue value\={value} format\="currency" />
337
- </IressBadge\>
338
- );
339
- export const TableSorting \= () \=> (
340
- <IressTable
341
- caption\="My investments"
342
- rows\={\[
343
- {
344
- investment\_name: 'Artemis Fund Managers Limited',
345
- cost: 23898,
346
- investmentDate: '2019-09-23',
347
- totalPercentage: 24.8,
348
- },
349
- {
350
- investment\_name: 'CASH.CASH',
351
- cost: 49751.4,
352
- investmentDate: '2020-06-28',
353
- totalPercentage: 49,
354
- },
355
- {
356
- investment\_name: 'VODAFONE GRP',
357
- cost: 26382.456,
358
- investmentDate: '2019-02-05',
359
- totalPercentage: 26.2,
360
- },
361
- \]}
362
-
363
- columns\={\[
364
- {
365
- key: 'investment\_name',
366
- label: 'Investment',
367
- divider: true,
368
- sort: 'asc',
369
- },
370
- {
371
- key: 'investmentDate',
372
- label: 'Date',
373
- format: 'date',
374
- sort: true,
375
- },
376
- {
377
- key: 'totalPercentage',
378
- label: 'Share',
379
- format: 'percent',
380
- sort: true,
381
- },
382
- {
383
- key: 'cost',
384
- label: 'Cost',
385
- align: 'right',
386
- sort: true,
387
- format: renderColumn,
388
- },
389
- \]}
390
- />
391
- );
392
-
393
- Copy
394
-
395
- ### [](#custom-sorting-logic)Custom sorting logic
396
-
397
- By default, sorting is automatically inferred from the raw column values.
398
-
399
- If you need to customise the sorting logic, you can use the `sortFn` property of the `TableColumn`. It accepts one of the following values:
400
-
401
- * A `string` referencing a built-in sort function: `alphanumeric`, `alphanumericCaseSensitive`, `text`, `textCaseSensitive`, `datetime` and `basic`. To understand how they work, visit the [Tanstack Table documentation](https://tanstack.com/table/v8/docs/api/features/sorting/#sorting-functions).
402
- * A custom sort function that takes two arguments: `a` and `b`, which are the two rows being compared. It should return `-1`, `0` or `1` depending on the comparison.
403
-
404
- My investments
405
- | Investment | Date | Share | Cost (sorts by net cost if available) |
406
- | --- | --- | --- | --- |
407
- | Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 (net: N/A) |
408
- | CASH.CASH | 28/06/2020 | 49% | $49,751.40 (net: $20,000.00) |
409
- | VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 (net: N/A) |
410
-
411
- Hide code
412
-
413
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
414
-
415
- import {
416
- IressTable,
417
- IressTableFormattedValue,
418
- IressTableProps,
419
- TableColumn,
420
- } from '@iress-oss/ids-components';
421
- type Props \= Partial<IressTableProps<Row, never\>>;
422
- interface Row {
423
- investment\_name: string;
424
- cost: number;
425
- netCost?: number;
426
- investmentDate: string;
427
- totalPercentage: number;
428
- }
429
- const columns: TableColumn<Row\>\[\] \= \[
430
- {
431
- key: 'investment\_name',
432
- label: 'Investment',
433
- divider: true,
434
- sort: 'asc',
435
- sortFn: 'textCaseSensitive',
436
- },
437
- {
438
- key: 'investmentDate',
439
- label: 'Date',
440
- format: 'date',
441
- sort: true,
442
- sortFn: 'datetime',
443
- },
444
- {
445
- key: 'totalPercentage',
446
- label: 'Share',
447
- format: 'percent',
448
- sort: true,
449
- sortFn: 'alphanumeric',
450
- },
451
- {
452
- key: 'cost',
453
- label: 'Cost (sorts by net cost if available)',
454
- align: 'right',
455
- format: (value: number, row) \=> {
456
- return (
457
- <\>
458
- <IressTableFormattedValue value\={value} format\="currency" /> (net:{' '}
459
- {row?.netCost ? (
460
- <IressTableFormattedValue value\={row.netCost} format\="currency" />
461
- ) : (
462
- 'N/A'
463
- )}
464
- ) </\>
465
- );
466
- },
467
- sortFn: (a, b) \=> {
468
- const aCost \= a.original.netCost ?? a.original.cost;
469
- const bCost \= b.original.netCost ?? b.original.cost;
470
- return aCost \- bCost;
471
- },
472
- },
473
- \];
474
- export const TableSortingFn \= () \=> (
475
- <IressTable<Row\>
476
- caption\="My investments"
477
- rows\={\[
478
- {
479
- investment\_name: 'Artemis Fund Managers Limited',
480
- cost: 23898,
481
- investmentDate: '2019-09-23',
482
- totalPercentage: 24.8,
483
- },
484
- {
485
- investment\_name: 'CASH.CASH',
486
- cost: 49751.4,
487
- netCost: 20000,
488
- investmentDate: '2020-06-28',
489
- totalPercentage: 49,
490
- },
491
- {
492
- investment\_name: 'VODAFONE GRP',
493
- cost: 26382.456,
494
- investmentDate: '2019-02-05',
495
- totalPercentage: 26.2,
496
- },
497
- \]}
498
-
499
- columns\={columns}
500
- /\>
501
- );
502
-
503
- Copy
504
-
505
- ### [](#width)Width
506
-
507
- The width of a column is controlled by the `width` property on the `TableColumn` object. It takes a string so it can be set to a pixel value or a percentage.
508
-
509
- When the table exceeds the width of the container, a horizontal scrollbar is triggered. This makes it possible to view larger tables on mobile devices.
510
-
511
- My investments
512
- | Investment | Cost | Investment date | Share |
513
- | --- | --- | --- | --- |
514
- | Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8% |
515
- | CASH.CASH | 49751.4 | 2020-06-28 | 49% |
516
- | VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2% |
517
-
518
- Hide code
519
-
520
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
521
-
522
- <IressTable
523
- caption\="My investments"
524
- rows\={\[
525
- {
526
- cost: 23898,
527
- investmentDate: '2019-09-23',
528
- investment\_name: 'Artemis Fund Managers Limited',
529
- totalPercentage: 24.8
530
- },
531
- {
532
- cost: 49751.4,
533
- investmentDate: '2020-06-28',
534
- investment\_name: 'CASH.CASH',
535
- totalPercentage: 49
536
- },
537
- {
538
- cost: 26382.456,
539
- investmentDate: '2019-02-05',
540
- investment\_name: 'VODAFONE GRP',
541
- totalPercentage: 26.2
542
- }
543
- \]}
544
- columns\={\[
545
- {
546
- key: 'investment\_name',
547
- label: 'Investment',
548
- width: '450px'
549
- },
550
- {
551
- key: 'cost',
552
- label: 'Cost',
553
- width: '220px'
554
- },
555
- {
556
- key: 'investmentDate',
557
- label: 'Investment date',
558
- width: '220px'
559
- },
560
- {
561
- format: 'percent',
562
- key: 'totalPercentage',
563
- label: 'Share'
564
- }
565
- \]}
566
- />
567
-
568
- Copy
569
-
570
- ### [](#alignment)Alignment
571
-
572
- Columns can be aligned using the `align` property on the `TableColumn` object. Columns can be aligned to the left, right or center.
573
-
574
- Currency and number formats are automatically right aligned to make the values easier to compare, but this can be overriden by setting the `align` property.
575
-
576
- My investments
577
- | Investment (left) | Cost (center) | Date (center) | Share (right) |
578
- | --- | --- | --- | --- |
579
- | Artemis Fund Managers Limited | $23,898.00 | 23/09/2019 | 24.8% |
580
- | CASH.CASH | $49,751.40 | 28/06/2020 | 49% |
581
- | VODAFONE GRP | $26,382.46 | 05/02/2019 | 26.2% |
582
-
583
- Hide code
584
-
585
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
586
-
587
- <IressTable
588
- caption\="My investments"
589
- rows\={\[
590
- {
591
- cost: 23898,
592
- investmentDate: '2019-09-23',
593
- investment\_name: 'Artemis Fund Managers Limited',
594
- totalPercentage: 24.8
595
- },
596
- {
597
- cost: 49751.4,
598
- investmentDate: '2020-06-28',
599
- investment\_name: 'CASH.CASH',
600
- totalPercentage: 49
601
- },
602
- {
603
- cost: 26382.456,
604
- investmentDate: '2019-02-05',
605
- investment\_name: 'VODAFONE GRP',
606
- totalPercentage: 26.2
607
- }
608
- \]}
609
- columns\={\[
610
- {
611
- align: 'left',
612
- key: 'investment\_name',
613
- label: 'Investment (left)'
614
- },
615
- {
616
- align: 'center',
617
- format: 'currency',
618
- key: 'cost',
619
- label: 'Cost (center)'
620
- },
621
- {
622
- align: 'center',
623
- format: 'date',
624
- key: 'investmentDate',
625
- label: 'Date (center)'
626
- },
627
- {
628
- align: 'right',
629
- format: 'percent',
630
- key: 'totalPercentage',
631
- label: 'Share (right)'
632
- }
633
- \]}
634
- />
635
-
636
- Copy
637
-
638
- ### [](#dividers)Dividers
639
-
640
- As a general rule we don't add vertical column borders to our tables. Sometimes though, it can be useful to add a vertical divider between columns to help group content and create visual separation.
641
-
642
- To add a vertical divider you can set the `divider` prop in the `TableColumn` to true. This will add a vertical border to the end of the column.
643
-
644
- My investments
645
- | Investment | Date | Share | Cost |
646
- | --- | --- | --- | --- |
647
- | Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 |
648
- | CASH.CASH | 28/06/2020 | 49% | $49,751.40 |
649
- | VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 |
650
-
651
- Hide code
652
-
653
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
654
-
655
- <IressTable
656
- caption\="My investments"
657
- rows\={\[
658
- {
659
- cost: 23898,
660
- investmentDate: '2019-09-23',
661
- investment\_name: 'Artemis Fund Managers Limited',
662
- totalPercentage: 24.8
663
- },
664
- {
665
- cost: 49751.4,
666
- investmentDate: '2020-06-28',
667
- investment\_name: 'CASH.CASH',
668
- totalPercentage: 49
669
- },
670
- {
671
- cost: 26382.456,
672
- investmentDate: '2019-02-05',
673
- investment\_name: 'VODAFONE GRP',
674
- totalPercentage: 26.2
675
- }
676
- \]}
677
- columns\={\[
678
- {
679
- divider: true,
680
- key: 'investment\_name',
681
- label: 'Investment'
682
- },
683
- {
684
- format: 'date',
685
- key: 'investmentDate',
686
- label: 'Date'
687
- },
688
- {
689
- format: 'percent',
690
- key: 'totalPercentage',
691
- label: 'Share'
692
- },
693
- {
694
- format: 'currency',
695
- key: 'cost',
696
- label: 'Cost'
697
- }
698
- \]}
699
- />
700
-
701
- Copy
702
-
703
- ### [](#highlight-on-hover)Highlight on hover
704
-
705
- This can be enabled by setting the `hover` prop. This will bring attention to the row the user is hovering over, allowing users to focus on the relationship between the columns of a specific row.
706
-
707
- My investments
708
- | Investment Name | Cost | Investment Date | Total Percentage |
709
- | --- | --- | --- | --- |
710
- | Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
711
- | CASH.CASH | 49751.4 | 2020-06-28 | 49 |
712
- | VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
713
-
714
- Hide code
715
-
716
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
717
-
718
- <IressTable
719
- caption\="My investments"
720
- rows\={\[
721
- {
722
- cost: 23898,
723
- investmentDate: '2019-09-23',
724
- investment\_name: 'Artemis Fund Managers Limited',
725
- totalPercentage: 24.8
726
- },
727
- {
728
- cost: 49751.4,
729
- investmentDate: '2020-06-28',
730
- investment\_name: 'CASH.CASH',
731
- totalPercentage: 49
732
- },
733
- {
734
- cost: 26382.456,
735
- investmentDate: '2019-02-05',
736
- investment\_name: 'VODAFONE GRP',
737
- totalPercentage: 26.2
738
- }
739
- \]}
740
- hover
741
- />
742
-
743
- Copy
744
-
745
- ### [](#scope)Scope
746
-
747
- `scope` defaults to row, which means the first cell in the row will be a `<th>`. When it is set to col the first cell in the row will be a `<td>`.
748
-
749
- My investments
750
- | Investment Name | Cost | Investment Date | Total Percentage |
751
- | --- | --- | --- | --- |
752
- | Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
753
- | CASH.CASH | 49751.4 | 2020-06-28 | 49 |
754
- | VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
755
-
756
- Hide code
757
-
758
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
759
-
760
- <IressTable
761
- caption\="My investments"
762
- rows\={\[
763
- {
764
- cost: 23898,
765
- investmentDate: '2019-09-23',
766
- investment\_name: 'Artemis Fund Managers Limited',
767
- totalPercentage: 24.8
768
- },
769
- {
770
- cost: 49751.4,
771
- investmentDate: '2020-06-28',
772
- investment\_name: 'CASH.CASH',
773
- totalPercentage: 49
774
- },
775
- {
776
- cost: 26382.456,
777
- investmentDate: '2019-02-05',
778
- investment\_name: 'VODAFONE GRP',
779
- totalPercentage: 26.2
780
- }
781
- \]}
782
- scope\="col"
783
- />
784
-
785
- Copy
786
-
787
- ### [](#hidden-header)Hidden header
788
-
789
- For very simple tabular data, you have the option to hide the table header with the `hiddenHeader` prop. When this is set to true, the table header will not be rendered.
790
-
791
- <table class="ids-table-v5150 ids-table--hidden-header-v5150" id=":ra:"><caption id=":ra:--caption" class="">My investments</caption><tbody><tr id=":ra:--rows--0"><th data-column="investment_name" id=":ra:__0_investment_name" scope="row">Artemis Fund Managers Limited</th><td data-column="cost" headers=":ra:__0_investment_name" id=":ra:__0_cost">23898</td><td data-column="investmentDate" headers=":ra:__0_investment_name" id=":ra:__0_investmentDate">2019-09-23</td><td data-column="totalPercentage" headers=":ra:__0_investment_name" id=":ra:__0_totalPercentage">24.8</td></tr><tr id=":ra:--rows--1"><th data-column="investment_name" id=":ra:__1_investment_name" scope="row">CASH.CASH</th><td data-column="cost" headers=":ra:__1_investment_name" id=":ra:__1_cost">49751.4</td><td data-column="investmentDate" headers=":ra:__1_investment_name" id=":ra:__1_investmentDate">2020-06-28</td><td data-column="totalPercentage" headers=":ra:__1_investment_name" id=":ra:__1_totalPercentage">49</td></tr><tr id=":ra:--rows--2"><th data-column="investment_name" id=":ra:__2_investment_name" scope="row">VODAFONE GRP</th><td data-column="cost" headers=":ra:__2_investment_name" id=":ra:__2_cost">26382.456</td><td data-column="investmentDate" headers=":ra:__2_investment_name" id=":ra:__2_investmentDate">2019-02-05</td><td data-column="totalPercentage" headers=":ra:__2_investment_name" id=":ra:__2_totalPercentage">26.2</td></tr></tbody></table>
792
-
793
- Hide code
794
-
795
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
796
-
797
- <IressTable
798
- caption\="My investments"
799
- rows\={\[
800
- {
801
- cost: 23898,
802
- investmentDate: '2019-09-23',
803
- investment\_name: 'Artemis Fund Managers Limited',
804
- totalPercentage: 24.8
805
- },
806
- {
807
- cost: 49751.4,
808
- investmentDate: '2020-06-28',
809
- investment\_name: 'CASH.CASH',
810
- totalPercentage: 49
811
- },
812
- {
813
- cost: 26382.456,
814
- investmentDate: '2019-02-05',
815
- investment\_name: 'VODAFONE GRP',
816
- totalPercentage: 26.2
817
- }
818
- \]}
819
- hiddenHeader
820
- />
821
-
822
- Copy
823
-
824
- ### [](#rich-rows-jsx)Rich rows (JSX)
825
-
826
- The `rows` prop allows you to use `ReactNodes` as the value of a cell. This can be useful for adding rich content to a cell, such as links, buttons or icons.
827
-
828
- **Note:** If you are using the `sort` property, the sorting may not work properly with rich content. If this happens, either remove the `sort` property or use the `format` prop on the column to set a custom formatter.
829
-
830
- My rich investments
831
- | Investment Name | Cost | Investment Date | Total Percentage |
832
- | --- | --- | --- | --- |
833
- | Artemis Fund Managers Limited | $23,898 | 2019/09/23 | 24.8% |
834
- | CASH.CASH | $49,751.40 | 2020/06/28 | 49% |
835
- | VODAFONE GRP | $26,382.46 | 2019/02/05 | 26.2% |
836
-
837
- Hide code
838
-
839
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
840
-
841
- <IressTable
842
- caption\="My rich investments"
843
- rows\={\[
844
- {
845
- cost: '$23,898',
846
- investmentDate: '2019/09/23',
847
- investment\_name: <IressButton\>Artemis Fund Managers Limited</IressButton\>,
848
- totalPercentage: <IressBadge mode\="info"\>24.8%</IressBadge\>
849
- },
850
- {
851
- cost: '$49,751.40',
852
- investmentDate: '2020/06/28',
853
- investment\_name: <IressButton\>CASH.CASH</IressButton\>,
854
- totalPercentage: <IressBadge mode\="success"\>49%</IressBadge\>
855
- },
856
- {
857
- cost: '$26,382.46',
858
- investmentDate: '2019/02/05',
859
- investment\_name: <IressButton\>VODAFONE GRP</IressButton\>,
860
- totalPercentage: <IressBadge mode\="info"\>26.2%</IressBadge\>
861
- }
862
- \]}
863
- />
864
-
865
- Copy
866
-
867
- ### [](#empty-state)Empty state
868
-
869
- You can provide the table with some content to display when there is no row data by using the `empty` prop.
870
-
871
- This is reliant on `columns` prop to provide the information for the table header. If `columns` is not provided and there is no row data the table will not render.
872
-
873
- | Investment | Date | Share | Cost |
874
- | --- | --- | --- | --- |
875
- | This table has no data |
876
-
877
- Hide code
878
-
879
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
880
-
881
- <IressTable
882
- columns\={\[
883
- {
884
- divider: true,
885
- key: 'investment\_name',
886
- label: 'Investment'
887
- },
888
- {
889
- format: 'date',
890
- key: 'investmentDate',
891
- label: 'Date'
892
- },
893
- {
894
- format: 'percent',
895
- key: 'totalPercentage',
896
- label: 'Share'
897
- },
898
- {
899
- align: 'right',
900
- format: 'currency',
901
- key: 'cost',
902
- label: 'Cost'
903
- }
904
- \]}
905
- empty\="This table has no data"
906
- rows\={\[\]}
907
- />
908
-
909
- Copy
910
-
911
- ### [](#static-table)Static table
912
-
913
- If you don't need all the fancy features of the table component, but would still like a styled table, you can use the `children` prop.
914
-
915
- It accepts any of the table sub-elements. To ensure best display, please make use of the `thead` and `tbody` tags.
916
-
917
- **Note:** Only the `caption`, `hiddenCaption`, `hiddenHeader` and `hover` props are supported when using `children` to render a table.
918
-
919
- My investments
920
- | Investment | Cost | Investment date | Share |
921
- | --- | --- | --- | --- |
922
- | Artemis Fund Managers Limited | $23,898 | 2019/09/23 | 24.8% |
923
- | CASH.CASH | $49,751.40 | 2020/06/28 | 49% |
924
- | VODAFONE GRP | $26,382.46 | 2019/02/05 | 26.2% |
925
-
926
- Hide code
927
-
928
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
929
-
930
- <IressTable caption\="My investments"\>
931
- <thead\>
932
- <tr\>
933
- <th\>
934
- Investment </th\>
935
- <th\>
936
- Cost </th\>
937
- <th\>
938
- Investment date </th\>
939
- <th\>
940
- Share </th\>
941
- </tr\>
942
- </thead\>
943
- <tbody\>
944
- <tr\>
945
- <th\>
946
- Artemis Fund Managers Limited </th\>
947
- <td\>
948
- $23,898 </td\>
949
- <td\>
950
- 2019/09/23 </td\>
951
- <td\>
952
- 24.8% </td\>
953
- </tr\>
954
- <tr\>
955
- <th\>
956
- CASH.CASH </th\>
957
- <td\>
958
- $49,751.40 </td\>
959
- <td\>
960
- 2020/06/28 </td\>
961
- <td\>
962
- 49% </td\>
963
- </tr\>
964
- <tr\>
965
- <th\>
966
- VODAFONE GRP </th\>
967
- <td\>
968
- $26,382.46 </td\>
969
- <td\>
970
- 2019/02/05 </td\>
971
- <td\>
972
- 26.2% </td\>
973
- </tr\>
974
- </tbody\>
975
- </IressTable\>
976
-
977
- Copy
978
-
979
- ### [](#row-props)Row props
980
-
981
- You can customise the rows by passing in a `rowProps` object or function. It accepts a map of table row props that can be passed to a `tr` element, or a function that accepts the row data currently being rendered, and returns a map of table props.
982
-
983
- My investments
984
- | Investment Name | Cost | Investment Date | Total Percentage |
985
- | --- | --- | --- | --- |
986
- | Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
987
- | CASH.CASH | 49751.4 | 2020-06-28 | 49 |
988
- | VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
989
-
990
- Hide code
991
-
992
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
993
-
994
- <IressTable
995
- caption\="My investments"
996
- rows\={\[
997
- {
998
- cost: 23898,
999
- investmentDate: '2019-09-23',
1000
- investment\_name: 'Artemis Fund Managers Limited',
1001
- totalPercentage: 24.8
1002
- },
1003
- {
1004
- cost: 49751.4,
1005
- investmentDate: '2020-06-28',
1006
- investment\_name: 'CASH.CASH',
1007
- totalPercentage: 49
1008
- },
1009
- {
1010
- cost: 26382.456,
1011
- investmentDate: '2019-02-05',
1012
- investment\_name: 'VODAFONE GRP',
1013
- totalPercentage: 26.2
1014
- }
1015
- \]}
1016
- rowProps\={(row) \=> ({
1017
- style: {
1018
- "--iress-row-even-background-color": row.original.cost && row.original.cost \> 30000 ? "white" : "lightblue",
1019
- "--iress-row-odd-background-color": row.original.cost && row.original.cost \> 30000 ? "white" : "lightblue"
1020
- }
1021
- })}
1022
- />
1023
-
1024
- Copy
1025
-
1026
- ### [](#compact)Compact
1027
-
1028
- The `compact` prop can be used to reduce the padding around the table cells and reduce the font size. This can be useful when you have a lot of data to display and allow users to see as many columns as possible.
1029
-
1030
- My investments
1031
- | Investment Name | Cost | Investment Date | Total Percentage |
1032
- | --- | --- | --- | --- |
1033
- | Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
1034
- | CASH.CASH | 49751.4 | 2020-06-28 | 49 |
1035
- | VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
1036
-
1037
- Hide code
1038
-
1039
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1040
-
1041
- <IressTable
1042
- caption\="My investments"
1043
- rows\={\[
1044
- {
1045
- cost: 23898,
1046
- investmentDate: '2019-09-23',
1047
- investment\_name: 'Artemis Fund Managers Limited',
1048
- totalPercentage: 24.8
1049
- },
1050
- {
1051
- cost: 49751.4,
1052
- investmentDate: '2020-06-28',
1053
- investment\_name: 'CASH.CASH',
1054
- totalPercentage: 49
1055
- },
1056
- {
1057
- cost: 26382.456,
1058
- investmentDate: '2019-02-05',
1059
- investment\_name: 'VODAFONE GRP',
1060
- totalPercentage: 26.2
1061
- }
1062
- \]}
1063
- compact
1064
- />
1065
-
1066
- Copy
1067
-
1068
- [](#iresstablebody)`IressTableBody`
1069
- -----------------------------------
1070
-
1071
- In some cases you may have a table with multiple groups of rows inside it, however the columns are the same. For these cases, you can use the `IressTableBody` component.
1072
-
1073
- <table class="ids-table-v5150" id=":rr:"><caption id=":rr:--caption" class="">My liabilities</caption><tbody aria-labelledby=":rs:--caption" class=""><tr><th aria-expanded="true" colspan="8" class="ids-table--row-group-header-v5150" id=":rs:--caption" scope="rowgroup" aria-controls=":rs:--header--0 :rs:--rows--0 :rs:--children"><button class="ids-table--activator-v5150" type="button">Current liabilities</button></th></tr><tr class="ids-table--row-group-column-headers-v5150" id=":rs:--header--0"><th id=":rs:__owner" headers=":rs:--caption" class="" style="width: 75px; min-width: 75px;">Owner</th><th id=":rs:__type" headers=":rs:--caption" class="" style="width: 100px; min-width: 100px;">Type</th><th id=":rs:__provider" headers=":rs:--caption" class="">Provider</th><th id=":rs:__status" headers=":rs:--caption" class="ids-table--divider-v5150">Status</th><th id=":rs:__frequency" headers=":rs:--caption" class="">Frequency</th><th id=":rs:__outstanding" headers=":rs:--caption" aria-sort="none" class="ids-table--cell--currency-v5150"><button type="button" class="ids-table--sort-button-v5150 ids-table--sort-button-no-wrap-v5150">Outstanding (GBP)<span role="img" class="ids-table--sort-icon-v5150 ids-icon-v5150 fa-sort fal" aria-label="sortable"></span></button></th><th id=":rs:__interestRate" headers=":rs:--caption" aria-sort="none" class="ids-table--cell--right-v5150"><button type="button" class="ids-table--sort-button-v5150 ids-table--sort-button-no-wrap-v5150">Interest rate p.a.<span role="img" class="ids-table--sort-icon-v5150 ids-icon-v5150 fa-sort fal" aria-label="sortable"></span></button></th><th id=":rs:__repayment" headers=":rs:--caption" aria-sort="none" class="ids-table--cell--currency-v5150"><button type="button" class="ids-table--sort-button-v5150 ids-table--sort-button-no-wrap-v5150">Repayment (GBP)<span role="img" class="ids-table--sort-icon-v5150 ids-icon-v5150 fa-sort fal" aria-label="sortable"></span></button></th></tr><tr id=":rs:--rows--0"><td data-column="owner" headers=":rs:__owner :rs:--caption" id=":rs:__0_owner" class="" style="width: 75px; min-width: 75px;">Client</td><td data-column="type" headers=":rs:__type :rs:--caption" id=":rs:__0_type" class="" style="width: 100px; min-width: 100px;">Credit card</td><td data-column="provider" headers=":rs:__provider :rs:--caption" id=":rs:__0_provider" class=""></td><td data-column="status" headers=":rs:__status :rs:--caption" id=":rs:__0_status" class="ids-table--divider-v5150">Current</td><td data-column="frequency" headers=":rs:__frequency :rs:--caption" id=":rs:__0_frequency" class="">Monthly</td><td data-column="outstanding" headers=":rs:__outstanding :rs:--caption" id=":rs:__0_outstanding" class="ids-table--cell--currency-v5150">5,000.00</td><td data-column="interestRate" headers=":rs:__interestRate :rs:--caption" id=":rs:__0_interestRate" class="ids-table--cell--right-v5150">0%</td><td data-column="repayment" headers=":rs:__repayment :rs:--caption" id=":rs:__0_repayment" class="ids-table--cell--currency-v5150">300.00</td></tr><tr id=":rs:--children"><td colspan="8"><button class="iress-form-element iress-form-element__inner iress-u-button iress--mode--tertiary" type="button"><span class="iress-u-button__prepend"><span role="img" class="ids-icon-v5150 fa-plus-circle fal" aria-hidden="true"></span></span>Add current liability</button></td></tr></tbody><tbody aria-labelledby=":ru:--caption" class=""><tr><th aria-expanded="false" colspan="8" class="ids-table--row-group-header-v5150" id=":ru:--caption" scope="rowgroup"><button class="ids-table--activator-v5150" type="button">Long term liabilities</button></th></tr></tbody><tbody aria-labelledby=":rv:--caption" class=""><tr><th aria-expanded="false" colspan="8" class="ids-table--row-group-header-v5150" id=":rv:--caption" scope="rowgroup"><button class="ids-table--activator-v5150" type="button">Contingent liabilities</button></th></tr></tbody></table>
1074
-
1075
- Hide code
1076
-
1077
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1078
-
1079
- interface Liability {
1080
- owner: string;
1081
- type: string;
1082
- provider?: string;
1083
- status: string;
1084
- outstanding: number;
1085
- interestRate: number;
1086
- repayment: number;
1087
- frequency: string;
1088
- }
1089
- const currentLiabilities \= \[
1090
- {
1091
- owner: 'Client',
1092
- type: 'Credit card',
1093
- status: 'Current',
1094
- outstanding: 5000,
1095
- interestRate: 0,
1096
- repayment: 300,
1097
- frequency: 'Monthly',
1098
- },
1099
- \];
1100
- const longTermLiabilities \= \[
1101
- {
1102
- owner: 'Joint',
1103
- type: 'Primary residence mortgage',
1104
- provider: 'Other',
1105
- status: 'Current',
1106
- outstanding: 1000000,
1107
- interestRate: 0,
1108
- repayment: 0,
1109
- frequency: 'Monthly',
1110
- },
1111
- {
1112
- owner: 'Joint',
1113
- type: 'Buy to let mortgage',
1114
- status: 'Current',
1115
- outstanding: 1000000,
1116
- interestRate: 0,
1117
- repayment: 0,
1118
- frequency: 'Monthly',
1119
- },
1120
- {
1121
- owner: 'Joint',
1122
- type: 'Buy to let mortgage',
1123
- status: 'Current',
1124
- outstanding: 5000,
1125
- interestRate: 0,
1126
- repayment: 0,
1127
- frequency: 'Monthly',
1128
- },
1129
- \];
1130
- const contingentLiabilities \= \[
1131
- {
1132
- owner: 'Partner',
1133
- type: 'Limited',
1134
- status: 'Current',
1135
- outstanding: 1000,
1136
- interestRate: 0,
1137
- repayment: 100,
1138
- frequency: 'Monthly',
1139
- },
1140
- \];
1141
- const columns: TableColumn<Liability\>\[\] \= \[
1142
- {
1143
- key: 'owner',
1144
- label: 'Owner',
1145
- width: '75px',
1146
- },
1147
- {
1148
- key: 'type',
1149
- label: 'Type',
1150
- width: '100px',
1151
- },
1152
- {
1153
- key: 'provider',
1154
- label: 'Provider',
1155
- },
1156
- {
1157
- key: 'status',
1158
- label: 'Status',
1159
- divider: true,
1160
- },
1161
- {
1162
- key: 'frequency',
1163
- label: 'Frequency',
1164
- },
1165
- {
1166
- key: 'outstanding',
1167
- label: 'Outstanding (GBP)',
1168
- format: 'currency',
1169
- currencyCode: '',
1170
- sort: true,
1171
- },
1172
- {
1173
- key: 'interestRate',
1174
- label: 'Interest rate p.a.',
1175
- format: 'percent',
1176
- align: 'right',
1177
- sort: true,
1178
- },
1179
- {
1180
- key: 'repayment',
1181
- label: 'Repayment (GBP)',
1182
- format: 'currency',
1183
- currencyCode: '',
1184
- sort: true,
1185
- },
1186
- \];
1187
- export const TableGroupedRows \= () \=> (
1188
- <IressTable caption\="My liabilities"\>
1189
- <IressTableBody
1190
- rows\={currentLiabilities}
1191
- columns\={columns}
1192
- caption\="Current liabilities"
1193
- scope\="col"
1194
- open
1195
- \>
1196
- <IressButton mode\="tertiary" prepend\={<IressIcon name\="plus-circle" />}\>
1197
- Add current liability </IressButton\>
1198
- </IressTableBody\>
1199
- <IressTableBody
1200
- rows\={longTermLiabilities}
1201
- columns\={columns}
1202
- caption\="Long term liabilities"
1203
- scope\="col"
1204
- \>
1205
- <IressButton mode\="tertiary" prepend\={<IressIcon name\="plus-circle" />}\>
1206
- Add long term liability </IressButton\>
1207
- </IressTableBody\>
1208
- <IressTableBody
1209
- rows\={contingentLiabilities}
1210
- columns\={columns}
1211
- caption\="Contingent liabilities"
1212
- scope\="col"
1213
- \>
1214
- <IressButton mode\="tertiary" prepend\={<IressIcon name\="plus-circle" />}\>
1215
- Add contingent liability </IressButton\>
1216
- </IressTableBody\>
1217
- </IressTable\>
1218
- );
1219
-
1220
- Copy
1221
-
1222
- [](#iresstableformattedvalue)`IressTableFormattedValue`
1223
- -------------------------------------------------------
1224
-
1225
- `IressTableFormattedValue` is the component used to format the table columns when the `format` property is not a render function.
1226
-
1227
- It has been exposed so you can use it in your own components to format values in the same way as the table component.
1228
-
1229
- IressTableFormattedValue
1230
- | Mode | Example |
1231
- | --- | --- |
1232
- | string | string |
1233
- | number | 10000 |
1234
- | date | 27/06/2025 |
1235
- | shortDate | 27 Jun 2025 |
1236
- | isoDateTime | 2025-06-27 04:09:53 (UTC) |
1237
- | relativeTime | now |
1238
- | currency | $10,000.00 |
1239
- | percent | 50% |
1240
-
1241
- Hide code
1242
-
1243
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1244
-
1245
- {
1246
- args: {
1247
- value: '100'
1248
- },
1249
- argTypes: {
1250
- ...disableArgTypes(\['format', 'value'\])
1251
- },
1252
- render: () \=> <IressTable caption\="IressTableFormattedValue" rows\={\[{
1253
- mode: 'string',
1254
- example: <IressTableFormattedValue value\="string" format\="string" />
1255
- }, {
1256
- mode: 'number',
1257
- example: <IressTableFormattedValue value\="10000" format\="number" />
1258
- }, {
1259
- mode: 'date',
1260
- example: <IressTableFormattedValue value\={new Date()} format\="date" />
1261
- }, {
1262
- mode: 'shortDate',
1263
- example: <IressTableFormattedValue value\={new Date()} format\="shortDate" />
1264
- }, {
1265
- mode: 'isoDateTime',
1266
- example: <IressTableFormattedValue value\={new Date()} format\="isoDateTime" />
1267
- }, {
1268
- mode: 'relativeTime',
1269
- example: <IressTableFormattedValue value\={new Date()} format\="relativeTime" />
1270
- }, {
1271
- mode: 'currency',
1272
- example: <IressTableFormattedValue value\={10000} format\="currency" />
1273
- }, {
1274
- mode: 'percent',
1275
- example: <IressTableFormattedValue value\={50} format\="percent" />
1276
- }\]} />
1277
- }
1278
-
1279
- Copy
1280
-
1281
- On this page
1282
-
1283
- * [Overview](#overview)
1284
- * [Props](#props)
1285
- * [Usage](#usage)
1286
- * [Automatic columns](#automatic-columns)
1287
- * [Custom columns](#custom-columns)
1288
- * [Column API](#column-api)
1289
- * [Examples](#examples)
1290
- * [Formats](#formats)
1291
- * [Sorting](#sorting)
1292
- * [Custom sorting logic](#custom-sorting-logic)
1293
- * [Width](#width)
1294
- * [Alignment](#alignment)
1295
- * [Dividers](#dividers)
1296
- * [Highlight on hover](#highlight-on-hover)
1297
- * [Scope](#scope)
1298
- * [Hidden header](#hidden-header)
1299
- * [Rich rows (JSX)](#rich-rows-jsx)
1300
- * [Empty state](#empty-state)
1301
- * [Static table](#static-table)
1302
- * [Row props](#row-props)
1303
- * [Compact](#compact)
1304
- * [IressTableBody](#iresstablebody)
1305
- * [IressTableFormattedValue](#iresstableformattedvalue)