@splunk/react-ui 5.7.1 → 5.9.0

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 (152) hide show
  1. package/Accordion.js +6 -6
  2. package/Anchor.js +2 -1
  3. package/Box.js +83 -34
  4. package/CHANGELOG.md +51 -0
  5. package/Calendar.js +134 -134
  6. package/Clickable.js +131 -94
  7. package/CollapsiblePanel.js +175 -137
  8. package/ComboBox.js +32 -27
  9. package/ControlGroup.js +92 -91
  10. package/DefinitionList.js +9 -9
  11. package/Drawer.d.ts +2 -0
  12. package/Drawer.js +679 -0
  13. package/Dropdown.js +27 -18
  14. package/DualListbox.js +1 -1
  15. package/File.js +35 -35
  16. package/JSONTree.js +73 -72
  17. package/Link.js +2 -2
  18. package/MIGRATION.md +10 -0
  19. package/Menu.js +403 -261
  20. package/Modal.js +263 -252
  21. package/Monogram.js +2 -2
  22. package/Multiselect.js +551 -385
  23. package/Number.js +2 -1
  24. package/Paginator.js +14 -12
  25. package/Popover.js +4 -1
  26. package/README.md +11 -0
  27. package/RadioBar.js +1 -1
  28. package/Search.js +111 -95
  29. package/Select.js +42 -40
  30. package/SelectBase.js +819 -715
  31. package/SidePanel.js +346 -167
  32. package/SlidingPanels.js +11 -11
  33. package/StepBar.js +7 -7
  34. package/Switch.js +5 -5
  35. package/Table.js +116 -119
  36. package/Text.js +48 -48
  37. package/TextArea.js +7 -7
  38. package/TransitionOpen.js +188 -169
  39. package/docs-llm/Accordion.md +267 -0
  40. package/docs-llm/Anchor Menu.md +115 -0
  41. package/docs-llm/Anchor.md +54 -0
  42. package/docs-llm/AnimationToggle.md +254 -0
  43. package/docs-llm/Avatar.md +292 -0
  44. package/docs-llm/Badge.md +212 -0
  45. package/docs-llm/Breadcrumbs.md +306 -0
  46. package/docs-llm/Button Group.md +53 -0
  47. package/docs-llm/Button.md +361 -0
  48. package/docs-llm/Card Layout.md +286 -0
  49. package/docs-llm/Card.md +619 -0
  50. package/docs-llm/Checkbox.md +218 -0
  51. package/docs-llm/Chip.md +291 -0
  52. package/docs-llm/Clickable.md +160 -0
  53. package/docs-llm/Code.md +292 -0
  54. package/docs-llm/Collapsible Panel.md +744 -0
  55. package/docs-llm/Color.md +253 -0
  56. package/docs-llm/Column Layout.md +391 -0
  57. package/docs-llm/Combo Box.md +540 -0
  58. package/docs-llm/Control Group.md +594 -0
  59. package/docs-llm/Date.md +270 -0
  60. package/docs-llm/Definition List.md +278 -0
  61. package/docs-llm/Divider.md +216 -0
  62. package/docs-llm/Drawer.md +414 -0
  63. package/docs-llm/Dropdown.md +472 -0
  64. package/docs-llm/Dual Listbox.md +325 -0
  65. package/docs-llm/File.md +653 -0
  66. package/docs-llm/Form Rows.md +374 -0
  67. package/docs-llm/Heading.md +179 -0
  68. package/docs-llm/Image.md +109 -0
  69. package/docs-llm/JSON Tree.md +260 -0
  70. package/docs-llm/Layer.md +74 -0
  71. package/docs-llm/Layout.md +50 -0
  72. package/docs-llm/Link.md +318 -0
  73. package/docs-llm/List.md +189 -0
  74. package/docs-llm/Markdown.md +179 -0
  75. package/docs-llm/Menu.md +735 -0
  76. package/docs-llm/Message Bar.md +236 -0
  77. package/docs-llm/Message.md +248 -0
  78. package/docs-llm/Modal.md +443 -0
  79. package/docs-llm/Monogram.md +159 -0
  80. package/docs-llm/Multiselect.md +939 -0
  81. package/docs-llm/Notifications.md +46 -0
  82. package/docs-llm/Number.md +298 -0
  83. package/docs-llm/Paginator.md +395 -0
  84. package/docs-llm/Paragraph.md +148 -0
  85. package/docs-llm/Phone Number.md +254 -0
  86. package/docs-llm/Popover.md +166 -0
  87. package/docs-llm/Progress.md +141 -0
  88. package/docs-llm/Radio Bar.md +303 -0
  89. package/docs-llm/Radio List.md +350 -0
  90. package/docs-llm/Resize.md +362 -0
  91. package/docs-llm/Screen Reader Content.md +73 -0
  92. package/docs-llm/Scroll Container Context.md +155 -0
  93. package/docs-llm/Scroll.md +152 -0
  94. package/docs-llm/Search.md +381 -0
  95. package/docs-llm/Select.md +985 -0
  96. package/docs-llm/Side Panel.md +777 -0
  97. package/docs-llm/Slider.md +339 -0
  98. package/docs-llm/Sliding Panels.md +340 -0
  99. package/docs-llm/Split Button.md +295 -0
  100. package/docs-llm/Static Content.md +90 -0
  101. package/docs-llm/Step Bar.md +292 -0
  102. package/docs-llm/Switch.md +268 -0
  103. package/docs-llm/Tab Bar.md +439 -0
  104. package/docs-llm/Tab Layout.md +398 -0
  105. package/docs-llm/Table.md +2642 -0
  106. package/docs-llm/Text Area.md +253 -0
  107. package/docs-llm/Text.md +339 -0
  108. package/docs-llm/Tooltip.md +325 -0
  109. package/docs-llm/Transition Open.md +406 -0
  110. package/docs-llm/Tree.md +591 -0
  111. package/docs-llm/Typography.md +125 -0
  112. package/docs-llm/Wait Spinner.md +121 -0
  113. package/docs-llm/llms.txt +101 -0
  114. package/package.json +6 -5
  115. package/types/src/Box/Box.d.ts +2 -10
  116. package/types/src/Drawer/Body.d.ts +17 -0
  117. package/types/src/Drawer/Drawer.d.ts +114 -0
  118. package/types/src/Drawer/DrawerContext.d.ts +11 -0
  119. package/types/src/Drawer/Footer.d.ts +25 -0
  120. package/types/src/Drawer/Header.d.ts +41 -0
  121. package/types/src/Drawer/docs/examples/Basic.d.ts +6 -0
  122. package/types/src/Drawer/docs/examples/ContainerPosition.d.ts +7 -0
  123. package/types/src/Drawer/docs/examples/InitialFocus.d.ts +9 -0
  124. package/types/src/Drawer/docs/examples/InlinePosition.d.ts +7 -0
  125. package/types/src/Drawer/docs/examples/PagePosition.d.ts +7 -0
  126. package/types/src/Drawer/index.d.ts +2 -0
  127. package/types/src/JSONTree/JSONTree.d.ts +12 -5
  128. package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
  129. package/types/src/Menu/Item.d.ts +2 -1
  130. package/types/src/Menu/docs/examples/SelectableCheckbox.d.ts +7 -0
  131. package/types/src/Modal/Modal.d.ts +1 -2
  132. package/types/src/Multiselect/Compact.d.ts +8 -3
  133. package/types/src/Multiselect/Multiselect.d.ts +8 -3
  134. package/types/src/Multiselect/Normal.d.ts +8 -3
  135. package/types/src/Multiselect/Option.d.ts +6 -3
  136. package/types/src/Multiselect/docs/examples/Disabled.d.ts +1 -0
  137. package/types/src/Select/Option.d.ts +6 -3
  138. package/types/src/Select/Select.d.ts +8 -5
  139. package/types/src/Select/docs/examples/Dimmed.d.ts +7 -0
  140. package/types/src/SelectBase/OptionBase.d.ts +6 -3
  141. package/types/src/SelectBase/SelectBase.d.ts +8 -3
  142. package/types/src/SidePanel/SidePanel.d.ts +43 -2
  143. package/types/src/SidePanel/docs/examples/DockLayout.d.ts +17 -0
  144. package/types/src/SidePanel/docs/examples/InitialFocus.d.ts +9 -0
  145. package/types/src/TransitionOpen/TransitionOpen.d.ts +29 -4
  146. package/types/src/useKeyPress/index.d.ts +9 -2
  147. package/types/src/useOnClickOutside/index.d.ts +2 -0
  148. package/types/src/useOnClickOutside/useOnClickOutside.d.ts +4 -0
  149. package/useKeyPress.js +23 -18
  150. package/useOnClickOutside.d.ts +2 -0
  151. package/useOnClickOutside.js +79 -0
  152. package/types/src/RadioList/docs/examples/Row.d.ts +0 -6
@@ -0,0 +1,619 @@
1
+ # Card
2
+
3
+ ## Overview
4
+
5
+
6
+ > Image: Illustration of a card component. There are two cards with headings and a definition list inside them.
7
+
8
+
9
+ ## When to use this component
10
+ Cards are a pattern that can be used to display a variety of information in a compact and organized manner. When deciding whether to use a card in your design, consider the following:
11
+ - If you have multiple pieces of related information that you want to present in a visually coherent manner, a card component can help to group and organize this information.
12
+ - Cards can help to increase the discoverability of the primary content by making it easier to scan and quickly understand what information is being presented.
13
+ - Cards can also be used to create interactive experiences, such as allowing users to expand or collapse content, or to navigate to other parts of the application.
14
+ - Cards are often designed to be flexible and to adjust their layout based on the size of the display. This makes them well-suited for responsive designs, where the layout needs to adjust to different screen sizes
15
+
16
+ ## When to use another component
17
+ While card components can be a useful design tool in many situations, there are also cases where they might not be the best choice. 
18
+ - If the information you are presenting is simple and straightforward, a card component might add unnecessary complexity. In these cases, a simpler layout or a single element, such as a heading and a paragraph, might be more appropriate.
19
+ - If you need to to manipulate other components or content within the same relative context.
20
+
21
+ ```mermaid
22
+ graph TD
23
+ accDescr: Decision tree that guides on when to use the Card component or something else
24
+ A(I want to display multiple items that are related to each other?) -- Yes --- B(Are the items interactive?)
25
+ B -- Yes --- C(Need to select one or more items?)
26
+ C -- Yes --- D(Use a selectable Card)
27
+ C -- No --- E(Need to view more details or take action?)
28
+ E -- Yes --- F(Use a clickable Card)
29
+ E -- No --- G(Use a basic Card)
30
+ B -- No --- H(Consider a different component, such as a Table or List.)
31
+ A -- No --- I(Consider a different component, such as a Button or List.)
32
+ ```
33
+
34
+
35
+ ## Behaviors
36
+
37
+ ### Clickable cards
38
+
39
+ A card that goes to a URL or performs an action when clicked. If a card's only function is to be viewed in more detail or opened, there is no need to include a button. Clicking on any part of the card should activate that action.
40
+
41
+ > Image: A card that is clickable, indicated by a hand cursor hovering over it, displaying interactivity. The clickable card has a title of
42
+
43
+
44
+ #### Links in clickable cards
45
+ Clickable cards can also contain individual or multiple links
46
+
47
+ > Image: A card that is clickable, also with a link. The card has a title
48
+
49
+
50
+ ### Selectable cards
51
+ Clicking on the surface of a card can toggle its state to selected.
52
+
53
+ <Message appearance="fill" type="warning">
54
+ <Message.Title>
55
+ <strong>Important</strong>
56
+ <p>Selectable cards do not come with any affordance that indicates their selection status by default.<strong> You MUST add an accessible affordance</strong> that is updated to match the cards selection state. Below we do this by adding a radio to the card. Using a radio or explicit text to indicate state are other examples of how to add a selectable affordance. Text color, background colors or borders cannot be used as the only visual affordance.</p>
57
+ </Message.Title>
58
+ </Message>
59
+
60
+ <Message appearance="fill" type="error">
61
+ <Message.Title>
62
+ <strong>Don't</strong>
63
+ <p>Cards that use selection as a mechanism to manipulate, filter and change other components or content within the same relative context should be avoided.</p>
64
+ </Message.Title>
65
+ </Message>
66
+
67
+ > Image: Two card components. The card on the left has a title
68
+
69
+
70
+ ### Cards with actions
71
+ Card.Header and Card.Footer are specific areas within the card that can contain actions, providing additional functionality and interactivity.
72
+
73
+ When adding actions to the Header, if there are more than two actions use a Dropdown Menu as an overflow menu. This should be unambiguously labelled to ensure the actions are unique when in a group of cards.
74
+ > Image: A card component with four actions. The card has a title
75
+
76
+
77
+
78
+ ## Usage
79
+
80
+ ### Nesting cards
81
+ Cards are their own individual containers and should not be nested in other containers, also avoid nesting cards within cards.
82
+
83
+ > Image: Example of two card components side by side. On the left is with a heart-eye emoji is a proper example of a basic card with a title and text-content. On the right with a grimacing-face emoji is an incorrect example of a card nested inside another card.
84
+
85
+
86
+ ### Actions
87
+ Best when actions use the appropriate visual hierarchy, a card must not have multiple primary buttons and should only include one primary action.
88
+
89
+ > Image: Example of two card components side by side. On the left is with a heart-eye emoji is a proper example with two buttons: a secondary and primary action, side-by-side aligned to the bottom right of the cards. On the right with a grimacing-face emoji is an incorrect example where the card has multiple primary actions.
90
+
91
+
92
+ ### Spacing
93
+ Keep the content concise and relevant. Avoid filling the space with too much content, as it can be overwhelming.
94
+
95
+ > Image: Example of two card components side by side. On the left is with a heart-eye emoji is a proper example where the content is concise and properly spaced. On the right with a grimacing-face emoji is an incorrect example where the content in the card is dense and tightly packed together making it difficult to consume.
96
+
97
+
98
+ ### Messaging
99
+ Avoid using cards to inform user about significant interface modifications or conditions. Instead use `Message bar` or `Message` to display significant conditions from the system or user actions.
100
+ > Image: Two examples side by side. On the left is with a heart-eye emoji is the proper example of a message bar with an error appearance being used inside of a Splunk application. On the right with a grimacing-face emoji is an incorrect example where are card is being used to display the status of the application, with the title
101
+
102
+
103
+ ## Examples
104
+
105
+
106
+ ### heading
107
+
108
+ ```typescript
109
+ import React from 'react';
110
+
111
+ import Card from '@splunk/react-ui/Card';
112
+ import DL from '@splunk/react-ui/DefinitionList';
113
+ import Heading from '@splunk/react-ui/Heading';
114
+
115
+ const heading = <Heading level={3}>Title</Heading>;
116
+
117
+
118
+ function Basic() {
119
+ return (
120
+ <Card>
121
+ <Card.Header title={heading} />
122
+ <Card.Body>
123
+ <DL termWidth="222px">
124
+ <DL.Term>First key</DL.Term>
125
+ <DL.Description>Value</DL.Description>
126
+ <DL.Term>Second key</DL.Term>
127
+ <DL.Description>Value</DL.Description>
128
+ <DL.Term>Third key</DL.Term>
129
+ <DL.Description>Value</DL.Description>
130
+ <DL.Term>Next key</DL.Term>
131
+ <DL.Description>Value</DL.Description>
132
+ <DL.Term>Another key</DL.Term>
133
+ <DL.Description>Value</DL.Description>
134
+ <DL.Term>Last key</DL.Term>
135
+ <DL.Description>Value</DL.Description>
136
+ </DL>
137
+ </Card.Body>
138
+ </Card>
139
+ );
140
+ }
141
+
142
+ export default Basic;
143
+ ```
144
+
145
+
146
+
147
+ ### heading
148
+
149
+ ```typescript
150
+ import React from 'react';
151
+
152
+ import Card from '@splunk/react-ui/Card';
153
+ import Heading from '@splunk/react-ui/Heading';
154
+ import Paragraph from '@splunk/react-ui/Paragraph';
155
+
156
+ const heading = <Heading level={3}>What is Splunk?</Heading>;
157
+
158
+
159
+ function HeadingTitle() {
160
+ return (
161
+ <Card style={{ width: 300 }}>
162
+ <Card.Header title={heading} />
163
+ <Card.Body>
164
+ <Paragraph>
165
+ Splunk Enterprise makes it simple to collect, analyze and act upon the untapped
166
+ value of the big data generated by your technology infrastructure, security
167
+ systems and business applications — giving you the insights to drive operational
168
+ performance and business results.
169
+ </Paragraph>
170
+ </Card.Body>
171
+ </Card>
172
+ );
173
+ }
174
+
175
+ export default HeadingTitle;
176
+ ```
177
+
178
+
179
+
180
+ ### basicTitle
181
+
182
+ ```typescript
183
+ import React from 'react';
184
+
185
+ import Star from '@splunk/react-icons/Star';
186
+ import Table from '@splunk/react-icons/Table';
187
+ import Button from '@splunk/react-ui/Button';
188
+ import Card from '@splunk/react-ui/Card';
189
+ import Heading from '@splunk/react-ui/Heading';
190
+ import P from '@splunk/react-ui/Paragraph';
191
+
192
+ const basicTitle = <Heading level={3}>Title</Heading>;
193
+ const longTitle = <Heading level={3}>This is a card with a really long title!</Heading>;
194
+ const insetTitle = <Heading level={3}>inset</Heading>;
195
+
196
+
197
+ function FullCard() {
198
+ const style = { width: 300, height: 400, margin: '0 20px 20px 0' };
199
+
200
+ return (
201
+ <div>
202
+ <Card style={style}>
203
+ <Card.Header title={basicTitle} subtitle="Subtitle" />
204
+ <Card.Body>
205
+ <P>
206
+ This card body demonstrates how you can use a Card to group related
207
+ information. Cards can contain text, images, and actions.
208
+ </P>
209
+ </Card.Body>
210
+ <Card.Footer>Footer</Card.Footer>
211
+ </Card>
212
+ <Card style={style}>
213
+ <Card.Header title={longTitle} subtitle="Full card example">
214
+ <div style={{ textAlign: 'right', color: '#f1b10e' }}>
215
+ <Star variant="filled" height="24px" width="24px" />
216
+ </div>
217
+ </Card.Header>
218
+ <Card.Body>
219
+ <P>
220
+ This card has a longer title and an icon in the header. Use cards to display
221
+ complex data in a compact, visually appealing way. You can add actions to
222
+ the footer for user interaction.
223
+ </P>
224
+ </Card.Body>
225
+ <Card.Footer>
226
+ <Button label="Footer button" />
227
+ </Card.Footer>
228
+ </Card>
229
+ <Card style={style}>
230
+ <Card.Header title={insetTitle} subtitle="Example" />
231
+ <Card.Body
232
+ inset={false}
233
+ style={{
234
+ color: '#3a87ad',
235
+ textAlign: 'center',
236
+ }}
237
+ >
238
+ <Table height="255px" width="295px" />
239
+ </Card.Body>
240
+ <Card.Footer>Footer</Card.Footer>
241
+ </Card>
242
+ </div>
243
+ );
244
+ }
245
+
246
+ export default FullCard;
247
+ ```
248
+
249
+
250
+
251
+ ### Card with images
252
+
253
+ A Card with Images. You can switch the order of Card.Header and Card.Body.
254
+
255
+ ```typescript
256
+ import React from 'react';
257
+
258
+ import CheckCircle from '@splunk/react-icons/CheckCircle';
259
+ import CircleHalfFilled from '@splunk/react-icons/CircleHalfFilled';
260
+ import Card from '@splunk/react-ui/Card';
261
+
262
+
263
+ function Images() {
264
+ const style = { width: 300, height: 400, margin: '0 20px 20px 0' };
265
+ return (
266
+ <div>
267
+ <Card style={style}>
268
+ <Card.Body
269
+ style={{
270
+ background: '#d9edf7',
271
+ textAlign: 'center',
272
+ padding: '84px 50px',
273
+ color: '#3a87ad',
274
+ borderRadius: '4px 4px 0 0',
275
+ }}
276
+ >
277
+ <CheckCircle variant="filled" height="150px" width="150px" />
278
+ </Card.Body>
279
+ <Card.Header title="Blue" subtitle="Check mark" />
280
+ </Card>
281
+ <Card style={style}>
282
+ <Card.Header title="Green" subtitle="Half circle" />
283
+ <Card.Body
284
+ style={{
285
+ background: '#d0e9be',
286
+ textAlign: 'center',
287
+ padding: '84px 50px',
288
+ color: '#65a637',
289
+ borderRadius: '0 0 4px 4px',
290
+ }}
291
+ >
292
+ <CircleHalfFilled height="150px" width="150px" />
293
+ </Card.Body>
294
+ </Card>
295
+ </div>
296
+ );
297
+ }
298
+
299
+ export default Images;
300
+ ```
301
+
302
+
303
+
304
+ ### heading
305
+
306
+ ```typescript
307
+ import React, { useCallback, useState } from 'react';
308
+
309
+ import Card from '@splunk/react-ui/Card';
310
+ import CardLayout from '@splunk/react-ui/CardLayout';
311
+ import Heading from '@splunk/react-ui/Heading';
312
+ import P from '@splunk/react-ui/Paragraph';
313
+
314
+ const heading = <Heading level={3}>What is Splunk?</Heading>;
315
+
316
+
317
+ function Clickable() {
318
+ const [timesClicked, setTimesClicked] = useState(0);
319
+
320
+ const clickAction = useCallback(() => {
321
+ setTimesClicked(timesClicked + 1);
322
+ }, [setTimesClicked, timesClicked]);
323
+
324
+ return (
325
+ <CardLayout cardWidth={300} gutterSize={20}>
326
+ <Card to="http://www.splunk.com" openInNewContext>
327
+ <Card.Header title={heading} subtitle="Click to learn more" />
328
+ <Card.Body>
329
+ <P>
330
+ Splunk Enterprise makes it simple to collect, analyze and act upon the
331
+ untapped value of the big data generated by your technology infrastructure,
332
+ security systems and business applications—giving you the insights to drive
333
+ operational performance and business results.
334
+ </P>
335
+ </Card.Body>
336
+ <Card.Footer>Splunk</Card.Footer>
337
+ </Card>
338
+ <Card onClick={clickAction}>
339
+ <Card.Header title={`Click count: ${timesClicked}`} />
340
+ <Card.Body>Click me please!</Card.Body>
341
+ <Card.Footer>Click count: {timesClicked}</Card.Footer>
342
+ </Card>
343
+ </CardLayout>
344
+ );
345
+ }
346
+
347
+ export default Clickable;
348
+ ```
349
+
350
+
351
+
352
+ ### StyledIconContainer
353
+
354
+ ```typescript
355
+ import React, { useState } from 'react';
356
+
357
+ import styled from 'styled-components';
358
+
359
+ import CheckRadioIcon from '@splunk/react-icons/CheckRadio';
360
+ import Card, { CardClickHandler } from '@splunk/react-ui/Card';
361
+ import Heading from '@splunk/react-ui/Heading';
362
+ import Layout from '@splunk/react-ui/Layout';
363
+ import Paragraph from '@splunk/react-ui/Paragraph';
364
+
365
+ const StyledIconContainer = styled.div`
366
+ display: flex;
367
+ justify-content: right;
368
+ `;
369
+
370
+
371
+ function Selectable() {
372
+ const [selectedValue, setSelectedValue] = useState(1);
373
+
374
+ const handleChange: CardClickHandler = (e, { value: clickValue }) => {
375
+ setSelectedValue(clickValue);
376
+ };
377
+
378
+ const cards = [1, 2, 3, 4].map((value) => {
379
+ const cardSelected = value === selectedValue;
380
+ const heading = <Heading level={3}>Card {value} title</Heading>;
381
+
382
+ return (
383
+ <Card
384
+ aria-checked={cardSelected}
385
+ key={value}
386
+ onClick={handleChange}
387
+ role="radio"
388
+ value={value}
389
+ >
390
+ <Card.Header title={heading} subtitle={`Card ${value} subtitle`}>
391
+ <StyledIconContainer>
392
+ <CheckRadioIcon
393
+ variant={cardSelected ? 'filled' : 'default'}
394
+ height="20px"
395
+ width="20px"
396
+ />
397
+ </StyledIconContainer>
398
+ </Card.Header>
399
+ <Card.Body>
400
+ <Paragraph style={{ width: 200 }}>Card body {value}</Paragraph>
401
+ </Card.Body>
402
+ </Card>
403
+ );
404
+ });
405
+ return <Layout role="radiogroup">{cards}</Layout>;
406
+ }
407
+
408
+ export default Selectable;
409
+ ```
410
+
411
+
412
+
413
+ ### Card with icon
414
+
415
+ A Card can have an icon in the header.
416
+
417
+ ```typescript
418
+ import React from 'react';
419
+
420
+ import Cube from '@splunk/react-icons/Cube';
421
+ import Card from '@splunk/react-ui/Card';
422
+
423
+
424
+ function WithIcon() {
425
+ return (
426
+ <Card style={{ width: 300 }}>
427
+ <Card.Header icon={<Cube />} title="Title" subtitle="subtitle" />
428
+ <Card.Body>
429
+ Splunk Enterprise makes it simple to collect, analyze and act upon the untapped
430
+ value of the big data generated by your technology infrastructure, security systems
431
+ and business applications.
432
+ </Card.Body>
433
+ </Card>
434
+ );
435
+ }
436
+
437
+ export default WithIcon;
438
+ ```
439
+
440
+
441
+
442
+ ### MoreActionsButton
443
+
444
+ ```typescript
445
+ import React from 'react';
446
+
447
+ import ArrowsCircularDouble from '@splunk/react-icons/ArrowsCircularDouble';
448
+ import Cross from '@splunk/react-icons/Cross';
449
+ import DotsThreeVertical from '@splunk/react-icons/DotsThreeVertical';
450
+ import Pencil from '@splunk/react-icons/Pencil';
451
+ import SquaresLayeredPlus from '@splunk/react-icons/SquaresLayeredPlus';
452
+ import Button from '@splunk/react-ui/Button';
453
+ import Card from '@splunk/react-ui/Card';
454
+ import CardLayout from '@splunk/react-ui/CardLayout';
455
+ import Dropdown from '@splunk/react-ui/Dropdown';
456
+ import Heading from '@splunk/react-ui/Heading';
457
+ import Layout from '@splunk/react-ui/Layout';
458
+ import Menu from '@splunk/react-ui/Menu';
459
+ import Tooltip from '@splunk/react-ui/Tooltip';
460
+
461
+ const MoreActionsButton = React.forwardRef<HTMLButtonElement, { content: string }>((props, ref) => {
462
+ return (
463
+ <Tooltip contentRelationship="label" {...props}>
464
+ <Button appearance="subtle" icon={<DotsThreeVertical />} ref={ref} />
465
+ </Tooltip>
466
+ );
467
+ });
468
+
469
+
470
+ const renderFirstCardActions = () => {
471
+ return (
472
+ <>
473
+ <Button appearance="subtle" icon={<Pencil variant="filled" />} />
474
+ <Dropdown toggle={<MoreActionsButton content="More actions for 1st card" />}>
475
+ <Menu>
476
+ <Menu.Item startAdornment={<ArrowsCircularDouble />}>Refresh</Menu.Item>
477
+ <Menu.Divider />
478
+ <Menu.Item startAdornment={<SquaresLayeredPlus />}>Duplicate</Menu.Item>
479
+ <Menu.Item startAdornment={<Cross />}>Delete</Menu.Item>
480
+ </Menu>
481
+ </Dropdown>
482
+ </>
483
+ );
484
+ };
485
+
486
+ const renderSecondCardActions = () => {
487
+ return (
488
+ <Dropdown toggle={<MoreActionsButton content="More actions for 2nd card" />}>
489
+ <Menu>
490
+ <Menu.Item>Favorite</Menu.Item>
491
+ <Menu.Item>Share</Menu.Item>
492
+ </Menu>
493
+ </Dropdown>
494
+ );
495
+ };
496
+
497
+ const heading = <Heading level={3}>Title</Heading>;
498
+
499
+ function Actions() {
500
+ return (
501
+ <CardLayout cardWidth={310} gutterSize={20}>
502
+ <Card>
503
+ <Card.Header
504
+ title={heading}
505
+ subtitle="subtitlesubtitlesubtitle"
506
+ actions={renderFirstCardActions}
507
+ />
508
+ <Card.Body>
509
+ Splunk Enterprise makes it simple to collect, analyze and act upon the untapped
510
+ value of the big data generated by your technology infrastructure, security
511
+ systems and business applications.
512
+ </Card.Body>
513
+ <Card.Footer>
514
+ <Layout style={{ justifyContent: 'flex-end' }}>
515
+ <Button appearance="secondary">Label</Button>
516
+ <Button appearance="primary">Label</Button>
517
+ </Layout>
518
+ </Card.Footer>
519
+ </Card>
520
+ <Card>
521
+ <Card.Header
522
+ title={heading}
523
+ subtitle="subtitlesubtitlesubtitle"
524
+ actions={renderSecondCardActions}
525
+ />
526
+ <Card.Body>
527
+ Splunk Enterprise makes it simple to collect, analyze and act upon the untapped
528
+ value of the big data generated by your technology infrastructure, security
529
+ systems and business applications.
530
+ </Card.Body>
531
+ <Card.Footer>
532
+ <Button>Action</Button>
533
+ </Card.Footer>
534
+ </Card>
535
+ </CardLayout>
536
+ );
537
+ }
538
+
539
+ export default Actions;
540
+ ```
541
+
542
+
543
+
544
+
545
+ ## API
546
+
547
+
548
+ ### Card API
549
+
550
+ #### Props
551
+
552
+ | Name | Type | Required | Default | Description |
553
+ |------|------|------|------|------|
554
+ | children | React.ReactNode | no | | Any children that can be rendered can be passed to the `Card`. To use the default Splunk UI `Card` styles, use the `Card.Header`, `Card.Body`, and `Card.Footer`. |
555
+ | elementRef | React.Ref<HTMLAnchorElement \| HTMLButtonElement \| HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
556
+ | onClick | CardClickHandler | no | | Callback when the `Card` is clicked. |
557
+ | openInNewContext | boolean | no | | To open the `to` link in a new window, set `openInNewContext` to `true`. |
558
+ | selected | boolean | no | | **DEPRECATED**: This prop is deprecated and will be removed in the next major version. Renders `Card` as selected if set to `true`. Use only when `onClick` is also provided. |
559
+ | tag | 'article' \| 'div' \| 'aside' \| 'section' | no | | Overrides the HTML tag for the Card component. Defaults to `article`. Ignored if `to` or `onClick` are present. |
560
+ | to | string | no | | Takes a URL to go to when the `Card` is clicked. |
561
+ | value | any | no | | Returns a value on click. Use when composing or if you have more than one selectable `Card`. |
562
+
563
+ #### Types
564
+
565
+ | Name | Type | Description |
566
+ |------|------|------|
567
+ | CardClickHandler | ( event: React.MouseEvent<HTMLAnchorElement \| HTMLButtonElement>, data: { selected: boolean; value?: any; // eslint-disable-line @typescript-eslint/no-explicit-any } ) => void | |
568
+
569
+
570
+
571
+ ### Card.Header API
572
+
573
+ A styled container for `Card` header content.
574
+
575
+ #### Props
576
+
577
+ | Name | Type | Required | Default | Description |
578
+ |------|------|------|------|------|
579
+ | actionPrimary | React.ReactNode | no | | Adds a primary action to the header. For best results, use an icon-only button style. |
580
+ | actions | () => React.ReactNode | no | | Renders the card actions. This prop cannot be used with actionPrimary and actionsSecondary. |
581
+ | actionsSecondary | React.ReactNode | no | | Adds a secondary actions dropdown menu to the header with an "Actions" label. Make this prop a `Menu`. The `actions` prop is preferred so that a custom and unambiguous label can be added. |
582
+ | anchor | string | no | | **DEPRECATED**: This prop is deprecated and will be removed in the next major version. Make the title an anchor so it can be bookmarked with a fragment. |
583
+ | children | React.ReactNode | no | | |
584
+ | elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
585
+ | icon | React.ReactNode | no | | The icon to show before the title. |
586
+ | subtitle | React.ReactNode | no | | Used as the subheading. |
587
+ | title | React.ReactNode | no | | Used as the main heading. |
588
+ | truncateTitle | boolean | no | true | Do not wrap Title and Subtitle. Long titles will truncate with an ellipsis. |
589
+
590
+
591
+
592
+ ### Card.Body API
593
+
594
+ A styled container for `Card` body content.
595
+
596
+ #### Props
597
+
598
+ | Name | Type | Required | Default | Description |
599
+ |------|------|------|------|------|
600
+ | children | React.ReactNode | no | | |
601
+ | elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
602
+ | inset | boolean | no | true | When true renders the `Card.Body` with padding. When false renders the `Card.Body` without padding. Default to true. |
603
+
604
+
605
+
606
+ ### Card.Footer API
607
+
608
+ A styled container for `Card` footer content.
609
+
610
+ #### Props
611
+
612
+ | Name | Type | Required | Default | Description |
613
+ |------|------|------|------|------|
614
+ | children | React.ReactNode | no | | |
615
+ | elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
616
+
617
+
618
+
619
+