@redis-ui/components 51.14.1 → 51.16.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 (72) hide show
  1. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.cjs +27 -15
  2. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.js +27 -15
  3. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.cjs +28 -1
  4. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.d.ts +2 -0
  5. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.js +29 -2
  6. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.cjs +4 -0
  7. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.d.ts +3 -0
  8. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.js +4 -1
  9. package/dist/CodeBlock/CodeBlock.cjs +47 -0
  10. package/dist/CodeBlock/CodeBlock.d.ts +2 -0
  11. package/dist/CodeBlock/CodeBlock.js +47 -0
  12. package/dist/CodeBlock/CodeBlock.style.cjs +49 -0
  13. package/dist/CodeBlock/CodeBlock.style.d.ts +10 -0
  14. package/dist/CodeBlock/CodeBlock.style.js +44 -0
  15. package/dist/CodeBlock/CodeBlock.types.cjs +4 -0
  16. package/dist/CodeBlock/CodeBlock.types.d.ts +15 -0
  17. package/dist/CodeBlock/CodeBlock.types.js +4 -0
  18. package/dist/CodeBlock/index.d.ts +2 -0
  19. package/dist/CodeBlock/index.js +2 -0
  20. package/dist/Drawer/components/Description/Description.cjs +1 -1
  21. package/dist/Drawer/components/Description/Description.js +1 -1
  22. package/dist/Drawer/components/Header/components/Title/Title.cjs +1 -1
  23. package/dist/Drawer/components/Header/components/Title/Title.js +1 -1
  24. package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.cjs +1 -1
  25. package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.js +1 -1
  26. package/dist/Inputs/components/InputTag/InputTag.cjs +1 -1
  27. package/dist/Inputs/components/InputTag/InputTag.js +1 -1
  28. package/dist/Modal/components/Content/components/Description/Description.cjs +1 -1
  29. package/dist/Modal/components/Content/components/Description/Description.js +1 -1
  30. package/dist/Modal/components/Content/components/Header/components/Title/Title.cjs +1 -1
  31. package/dist/Modal/components/Content/components/Header/components/Title/Title.js +1 -1
  32. package/dist/Select/components/Trigger/components/Compose/Compose.cjs +1 -1
  33. package/dist/Select/components/Trigger/components/Compose/Compose.js +1 -1
  34. package/dist/SideBar/SideBar.cjs +2 -0
  35. package/dist/SideBar/SideBar.constants.cjs +2 -0
  36. package/dist/SideBar/SideBar.constants.d.ts +2 -0
  37. package/dist/SideBar/SideBar.constants.js +2 -0
  38. package/dist/SideBar/SideBar.d.ts +4 -0
  39. package/dist/SideBar/SideBar.js +2 -0
  40. package/dist/SideBar/components/CollapseButton/CollapseButton.cjs +1 -1
  41. package/dist/SideBar/components/CollapseButton/CollapseButton.js +1 -1
  42. package/dist/SideBar/components/CollapseButton/CollapseButton.style.d.ts +1 -0
  43. package/dist/SideBar/components/ExpandableItem/ExpandableItem.cjs +78 -0
  44. package/dist/SideBar/components/ExpandableItem/ExpandableItem.context.cjs +11 -0
  45. package/dist/SideBar/components/ExpandableItem/ExpandableItem.context.d.ts +4 -0
  46. package/dist/SideBar/components/ExpandableItem/ExpandableItem.context.js +8 -0
  47. package/dist/SideBar/components/ExpandableItem/ExpandableItem.d.ts +6 -0
  48. package/dist/SideBar/components/ExpandableItem/ExpandableItem.js +78 -0
  49. package/dist/SideBar/components/ExpandableItem/ExpandableItem.style.cjs +36 -0
  50. package/dist/SideBar/components/ExpandableItem/ExpandableItem.style.d.ts +7 -0
  51. package/dist/SideBar/components/ExpandableItem/ExpandableItem.style.js +30 -0
  52. package/dist/SideBar/components/ExpandableItem/ExpandableItem.types.d.ts +21 -0
  53. package/dist/SideBar/components/ExpandableItem/ExpandableItem.types.js +1 -0
  54. package/dist/SideBar/components/Item/Item.cjs +4 -1
  55. package/dist/SideBar/components/Item/Item.js +4 -1
  56. package/dist/SideBar/components/Item/Item.style.cjs +7 -4
  57. package/dist/SideBar/components/Item/Item.style.d.ts +1 -0
  58. package/dist/SideBar/components/Item/Item.style.js +7 -4
  59. package/dist/SideBar/components/Item/components/Text/Text.cjs +3 -0
  60. package/dist/SideBar/components/Item/components/Text/Text.js +3 -0
  61. package/dist/SideBar/components/Item/components/Text/Text.style.cjs +3 -2
  62. package/dist/SideBar/components/Item/components/Text/Text.style.d.ts +1 -0
  63. package/dist/SideBar/components/Item/components/Text/Text.style.js +3 -2
  64. package/dist/SideBar/index.d.ts +1 -0
  65. package/dist/index.cjs +7 -1
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.js +5 -2
  68. package/package.json +2 -2
  69. package/skills/redis-ui-components/SKILL.md +1 -0
  70. package/skills/redis-ui-components/references/CodeBlock.md +79 -0
  71. package/skills/redis-ui-components/references/CopyToClipboardButton.md +37 -1
  72. package/skills/redis-ui-components/references/SideBar.md +115 -1
package/dist/index.cjs CHANGED
@@ -20,7 +20,9 @@ const require_ActionIconButton = require("./Button/ActionIconButton/ActionIconBu
20
20
  const require_ActionIconButton_types = require("./Button/ActionIconButton/ActionIconButton.types.cjs");
21
21
  const require_ToggleButton_style = require("./Button/ToggleButton/ToggleButton.style.cjs");
22
22
  const require_ToggleButton = require("./Button/ToggleButton/ToggleButton.cjs");
23
+ const require_ScreenReaderAnnounce = require("./ScreenReaderAnnounce/ScreenReaderAnnounce.cjs");
23
24
  const require_CopyToClipboardButton = require("./Button/CopyToClipboardButton/CopyToClipboardButton.cjs");
25
+ const require_CopyToClipboardButton_types = require("./Button/CopyToClipboardButton/CopyToClipboardButton.types.cjs");
24
26
  const require_Link = require("./Link/Link.cjs");
25
27
  const require_react_utils = require("./Helpers/react.utils.cjs");
26
28
  const require_generateId = require("./Helpers/generateId.cjs");
@@ -69,6 +71,8 @@ const require_Compose_style = require("./Chip/components/Compose/Compose.style.c
69
71
  const require_Chip = require("./Chip/Chip.cjs");
70
72
  const require_Overflow = require("./Overflow/Overflow.cjs");
71
73
  const require_ChipList = require("./ChipList/ChipList.cjs");
74
+ const require_CodeBlock = require("./CodeBlock/CodeBlock.cjs");
75
+ const require_CodeBlock_types = require("./CodeBlock/CodeBlock.types.cjs");
72
76
  const require_CountryFlag = require("./CountryFlag/CountryFlag.cjs");
73
77
  const require_Drawer = require("./Drawer/Drawer.cjs");
74
78
  const require_TreeView = require("./TreeView/TreeView.cjs");
@@ -94,7 +98,6 @@ const require_MultiSelect = require("./MultiSelect/MultiSelect.cjs");
94
98
  const require_Pagination_context = require("./Pagination/Pagination.context.cjs");
95
99
  const require_Pagination = require("./Pagination/Pagination.cjs");
96
100
  const require_RadioGroup = require("./RadioGroup/RadioGroup.cjs");
97
- const require_ScreenReaderAnnounce = require("./ScreenReaderAnnounce/ScreenReaderAnnounce.cjs");
98
101
  const require_TableHeading = require("./TableHeading/TableHeading.cjs");
99
102
  const require_SearchBar = require("./SearchBar/SearchBar.cjs");
100
103
  const require_Section = require("./Section/Section.cjs");
@@ -161,6 +164,7 @@ exports.Checkbox = require_Checkbox.default;
161
164
  exports.Chip = require_Chip.default;
162
165
  exports.ChipContainer = require_Compose_style.ChipContainer;
163
166
  exports.ChipList = require_ChipList.default;
167
+ exports.CodeBlock = require_CodeBlock.default;
164
168
  exports.ContextProvider = require_InputValue_context.ContextProvider;
165
169
  exports.CopyToClipboardButton = require_CopyToClipboardButton.default;
166
170
  exports.CountryFlag = require_CountryFlag.default;
@@ -274,7 +278,9 @@ Object.defineProperty(exports, "cardVariants", {
274
278
  }
275
279
  });
276
280
  exports.childrenToString = require_react_utils.childrenToString;
281
+ exports.codeBlockSizes = require_CodeBlock_types.codeBlockSizes;
277
282
  exports.combineHandlers = require_react_utils.combineHandlers;
283
+ exports.copyToClipboardButtonVariants = require_CopyToClipboardButton_types.copyToClipboardButtonVariants;
278
284
  exports.createNullableContext = require_NullableContext.createNullableContext;
279
285
  exports.createPrimitiveContextState = require_PrimitiveContextState.createPrimitiveContextState;
280
286
  exports.debounce = require_debounce.debounce;
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from './Card';
11
11
  export * from './Checkbox';
12
12
  export * from './Chip';
13
13
  export * from './ChipList';
14
+ export * from './CodeBlock';
14
15
  export * from './CountryFlag';
15
16
  export * from './Drawer';
16
17
  export * from './Filters';
package/dist/index.js CHANGED
@@ -19,7 +19,9 @@ import ActionIconButton from "./Button/ActionIconButton/ActionIconButton.js";
19
19
  import { actionIconButtonSizes, buttonWithIconVariants } from "./Button/ActionIconButton/ActionIconButton.types.js";
20
20
  import { ToggleButton_style_exports } from "./Button/ToggleButton/ToggleButton.style.js";
21
21
  import ToggleButton from "./Button/ToggleButton/ToggleButton.js";
22
+ import { ScreenReaderAnnounce } from "./ScreenReaderAnnounce/ScreenReaderAnnounce.js";
22
23
  import CopyToClipboardButton from "./Button/CopyToClipboardButton/CopyToClipboardButton.js";
24
+ import { copyToClipboardButtonVariants } from "./Button/CopyToClipboardButton/CopyToClipboardButton.types.js";
23
25
  import Link from "./Link/Link.js";
24
26
  import { childrenToString, combineHandlers, forwardRefWithGenerics, handlePreventDefault, handleStopPropagation, isFragmentElement, isTextualNode, memoWithGenerics } from "./Helpers/react.utils.js";
25
27
  import { generateId, useGeneratedId } from "./Helpers/generateId.js";
@@ -69,6 +71,8 @@ import { ChipContainer } from "./Chip/components/Compose/Compose.style.js";
69
71
  import Chip from "./Chip/Chip.js";
70
72
  import { Overflow } from "./Overflow/Overflow.js";
71
73
  import ChipList from "./ChipList/ChipList.js";
74
+ import CodeBlock from "./CodeBlock/CodeBlock.js";
75
+ import { codeBlockSizes } from "./CodeBlock/CodeBlock.types.js";
72
76
  import CountryFlag from "./CountryFlag/CountryFlag.js";
73
77
  import Drawer from "./Drawer/Drawer.js";
74
78
  import TreeView from "./TreeView/TreeView.js";
@@ -94,7 +98,6 @@ import MultiSelect from "./MultiSelect/MultiSelect.js";
94
98
  import { usePaginationContext } from "./Pagination/Pagination.context.js";
95
99
  import { Pagination } from "./Pagination/Pagination.js";
96
100
  import RadioGroup from "./RadioGroup/RadioGroup.js";
97
- import { ScreenReaderAnnounce } from "./ScreenReaderAnnounce/ScreenReaderAnnounce.js";
98
101
  import TableHeading from "./TableHeading/TableHeading.js";
99
102
  import SearchBar from "./SearchBar/SearchBar.js";
100
103
  import Section from "./Section/Section.js";
@@ -114,4 +117,4 @@ import { ProgressBar } from "./ProgressBar/ProgressBar.js";
114
117
  import { ProfileIcon_style_exports } from "./ProfileIcon/ProfileIcon.style.js";
115
118
  import ProfileIcon from "./ProfileIcon/ProfileIcon.js";
116
119
  import Slider from "./Slider/Slider.js";
117
- export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, Hero, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardVariants, childrenToString, combineHandlers, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
120
+ export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, CodeBlock, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, Hero, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardVariants, childrenToString, codeBlockSizes, combineHandlers, copyToClipboardButtonVariants, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redis-ui/components",
3
3
  "license": "UNLICENSED",
4
- "version": "51.14.1",
4
+ "version": "51.16.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "repository": "git@github.com:redislabsdev/redis-ui.git",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@redis-ui/icons": "^8.0.0 || ^9.0.0 || ^10.0.0",
33
- "@redis-ui/styles": "^21.20.0",
33
+ "@redis-ui/styles": "^21.23.0",
34
34
  "react": "^18.0.0 || ^19.0.0",
35
35
  "react-dom": "^18.0.0 || ^19.0.0",
36
36
  "styled-components": "^5.0.0"
@@ -162,6 +162,7 @@ Always check the relevant component reference before using a component. The refe
162
162
 
163
163
  - [Badge](./references/Badge.md)
164
164
  - [Chip](./references/Chip.md)
165
+ - [CodeBlock](./references/CodeBlock.md)
165
166
  - [ChipList](./references/ChipList.md)
166
167
  - [Label](./references/Label.md)
167
168
  - [Link](./references/Link.md)
@@ -0,0 +1,79 @@
1
+ # CodeBlock
2
+
3
+ A multi-line code block for snippets, commands and JSON, with an optional copy button. Use `Typography.Code` for inline code.
4
+
5
+ ## Import
6
+ ```tsx
7
+ import { CodeBlock } from '@redis-ui/components';
8
+ ```
9
+
10
+ ## Props
11
+ | Prop | Type | Default | Description |
12
+ |------|------|---------|-------------|
13
+ | code | `string` | *required* | Text rendered in the block and copied by the copy button |
14
+ | copyLabel | `string` | - | Shows a copy button and is used as its accessible name |
15
+ | wrap | `boolean` | `false` | Wraps long lines instead of scrolling horizontally. Use for commands and prompts |
16
+ | maxHeight | `string` | - | Scrolls vertically past this height (any CSS length, e.g. `'19rem'`) |
17
+ | size | `'M' \| 'S'` | `'M'` | Text size. `S` is the compact size |
18
+ | native div props | `Omit<HTMLAttributes<HTMLDivElement>, 'children'>` | - | Passed to the root element. `aria-label` names the block when it scrolls (defaults to `Code`) |
19
+
20
+ ## Examples
21
+
22
+ ### Playground
23
+
24
+ ```tsx
25
+ <CodeBlock code={lensSnippet} copyLabel="Copy code" wrap={false} size="M" />
26
+ ```
27
+
28
+ ### Default
29
+
30
+ ```tsx
31
+ <CodeBlock code={lensSnippet} />
32
+ ```
33
+
34
+ ### Copyable
35
+
36
+ ```tsx
37
+ <CodeBlock code={installCommand} copyLabel="Copy install command" />
38
+ <CodeBlock code={lensSnippet} copyLabel="Copy code" />
39
+ ```
40
+
41
+ ### WrappedCommand
42
+
43
+ > `wrap` breaks long lines anywhere. Use it for commands and prompts.
44
+
45
+ ```tsx
46
+ <CodeBlock code={initCommand} copyLabel="Copy command" wrap />
47
+ ```
48
+
49
+ ### HorizontalScroll
50
+
51
+ > Without `wrap`, long lines scroll horizontally, including inside flex and grid layouts.
52
+
53
+ ```tsx
54
+ <div style={{ display: 'flex', maxWidth: '48rem' }}>
55
+ <CodeBlock code={clientConfig} copyLabel="Copy code" style={{ flex: 1 }} />
56
+ </div>
57
+ ```
58
+
59
+ ### MaxHeight
60
+
61
+ ```tsx
62
+ <CodeBlock code={longJson} copyLabel="Copy JSON" maxHeight="19rem" />
63
+ ```
64
+
65
+ ### Sizes
66
+
67
+ ```tsx
68
+ import { CodeBlock, codeBlockSizes } from '@redis-ui/components';
69
+
70
+ {codeBlockSizes.map((size) => (
71
+ <CodeBlock key={size} code={lensSnippet} copyLabel="Copy code" size={size} />
72
+ ))}
73
+ ```
74
+
75
+ ## Notes
76
+ - The component forwards refs to the root element.
77
+ - When the content overflows, the block becomes keyboard-focusable so it can be scrolled with the keyboard.
78
+ - The copy button is `CopyToClipboardButton` with `variant="outline"`, pinned to the top-right corner.
79
+ - No syntax highlighting: `code` is rendered as plain text.
@@ -12,6 +12,7 @@ import { CopyToClipboardButton } from '@redis-ui/components';
12
12
  |------|------|---------|-------------|
13
13
  | textToCopy | `string` | *required* | Text copied to the clipboard when the button is clicked |
14
14
  | copiedLabel | `string` | - | Optional label shown while the copied success state is active |
15
+ | variant | `'default' \| 'outline'` | `'default'` | `outline` renders a bordered square button for copyable values and code blocks |
15
16
  | native button props | `Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>` | - | Standard button attributes except `onClick`, which is handled internally |
16
17
 
17
18
  ## Examples
@@ -21,7 +22,40 @@ import { CopyToClipboardButton } from '@redis-ui/components';
21
22
  ```tsx
22
23
  import { CopyToClipboardButton } from '@redis-ui/components';
23
24
 
24
- <CopyToClipboardButton disabled={false} textToCopy="Hello, World!" copiedLabel="Copied!" />
25
+ <CopyToClipboardButton
26
+ disabled={false}
27
+ textToCopy="Hello, World!"
28
+ copiedLabel="Copied!"
29
+ variant="default"
30
+ />
31
+ ```
32
+
33
+ ### Variants
34
+
35
+ > `outline` is a bordered square button for copyable values and code blocks.
36
+
37
+ ```tsx
38
+ import {
39
+ CopyToClipboardButton,
40
+ copyToClipboardButtonVariants
41
+ } from '@redis-ui/components';
42
+
43
+ <>
44
+ {copyToClipboardButtonVariants.map((variant) => (
45
+ <CopyToClipboardButton
46
+ key={variant}
47
+ textToCopy={`${variant} variant`}
48
+ aria-label={`Copy ${variant}`}
49
+ variant={variant}
50
+ />
51
+ ))}
52
+ <CopyToClipboardButton
53
+ textToCopy="disabled"
54
+ aria-label="Copy disabled"
55
+ variant="outline"
56
+ disabled
57
+ />
58
+ </>
25
59
  ```
26
60
 
27
61
  ### Disabled
@@ -45,3 +79,5 @@ import { CopyToClipboardButton } from '@redis-ui/components';
45
79
  - After a successful copy, the icon changes to a check mark for 1.5 seconds before reverting.
46
80
  - If `copiedLabel` is provided, it is also used as the accessible label while the copied state is active.
47
81
  - If `copiedLabel` is omitted, the accessible label falls back to `Copy`.
82
+ - A successful copy is announced to screen readers (`copiedLabel`, or `Copied`).
83
+ - Use `variant="outline"` for copyable values in Ultra surfaces; `CodeBlock` uses it for its copy button.
@@ -32,6 +32,9 @@ The component also accepts all `FlexGroupProps` except `direction`, which is fix
32
32
  - `SideBar.Item.Text` - Text slot for a sidebar item.
33
33
  - `SideBar.Item.Button` - Compact action button rendered inside a sidebar item.
34
34
  - `SideBar.Item.Badge` - Badge slot rendered to the right of `Item.Text` (e.g. `NEW`, `BETA`).
35
+ - `SideBar.ExpandableItem` - Section root that opens and closes a list of nested items. Holds the open state.
36
+ - `SideBar.ExpandableItem.Trigger` - Parent row of a section, with a chevron that toggles it.
37
+ - `SideBar.ExpandableItem.Items` - List of nested `SideBar.Item`s, shown while the section is open.
35
38
  - `SideBar.Group` - Wrapper around a section's `Group.Title` and items. Use one `SideBar.Group` per logical section.
36
39
  - `SideBar.Group.Title` - Section label rendered above a group of items.
37
40
  - `SideBar.Footer` - Footer wrapper for metadata, links, and text.
@@ -102,6 +105,31 @@ This slot inherits all `ActionIconButtonProps` and defaults `size` to `M`. It is
102
105
 
103
106
  This slot inherits all `BadgeProps` from the base `Badge` component. It is shown next to item text when the sidebar is expanded and hidden while collapsed.
104
107
 
108
+ ### SideBar.ExpandableItem Props
109
+
110
+ | Prop | Type | Default | Description |
111
+ |------|------|---------|-------------|
112
+ | children | `React.ReactNode` | *required* | A `Trigger` followed by `Items` |
113
+ | isOpen | `boolean` | - | Controlled open state |
114
+ | defaultOpen | `boolean` | `true` | Initial open state when uncontrolled |
115
+ | onOpenChange | `(isOpen: boolean) => void` | - | Called when the section opens or closes |
116
+ | hasActiveChild | `boolean` | `false` | Highlights the trigger while the section is closed, so the active row stays visible |
117
+
118
+ The section is always shown closed while the sidebar is collapsed, so only the triggers stay in the rail.
119
+
120
+ ### SideBar.ExpandableItem.Trigger Props
121
+
122
+ | Prop | Type | Default | Description |
123
+ |------|------|---------|-------------|
124
+ | expandText | `string` | `'Expand'` | Accessible name of the chevron while the section is closed |
125
+ | collapseText | `string` | `'Collapse'` | Accessible name of the chevron while the section is open |
126
+
127
+ The trigger also accepts all `SideBar.Item` props. Clicking the row toggles the section (while the sidebar is expanded) and then calls `onClick`. The chevron only toggles the section. Compose it with `Item.Icon`, `Item.Text` and `Item.Badge` like a regular item. `Item.Button` is not supported on a trigger, since the chevron sits at the end of the row.
128
+
129
+ ### SideBar.ExpandableItem.Items Props
130
+
131
+ This list accepts standard `HTMLAttributes<HTMLUListElement>`. Its `SideBar.Item` children render as nested rows: shorter than top-level items, with their label lined up with the trigger's label. Nested items don't need an `Item.Icon`.
132
+
105
133
  ### SideBar.Group Props
106
134
 
107
135
  This wrapper accepts standard `HTMLAttributes<HTMLDivElement>`. Place a `SideBar.Group.Title` and the section's items inside.
@@ -664,6 +692,90 @@ const [expanded, setExpanded] = useState(true);
664
692
  </SideBar>
665
693
  ```
666
694
 
695
+ ### ExpandableItem Playground
696
+
697
+ > A section with children. Click the row or the chevron to open and close it.
698
+
699
+ ```tsx
700
+ import { SideBar } from '@redis-ui/components';
701
+ import { DatabaseIcon, IconType, SettingsIcon, StarsIcon } from '@redis-ui/icons';
702
+ import { useState } from 'react';
703
+
704
+ const sections: { label: string; icon: IconType; children: string[] }[] = [
705
+ { label: 'Databases', icon: DatabaseIcon, children: ['Redis', 'Redis Flex'] },
706
+ {
707
+ label: 'Iris',
708
+ icon: StarsIcon,
709
+ children: ['Agent Playbooks', 'Agent Memory', 'Context Gateway', 'Lens']
710
+ }
711
+ ];
712
+
713
+ const Section = ({ label, icon, children, activeLink, onNavigate, defaultOpen }) => (
714
+ <SideBar.ExpandableItem defaultOpen={defaultOpen} hasActiveChild={children.includes(activeLink)}>
715
+ <SideBar.ExpandableItem.Trigger
716
+ isActive={activeLink === label}
717
+ onClick={() => onNavigate(label)}
718
+ tooltipProps={{ text: label, placement: 'right' }}
719
+ expandText={`Expand ${label}`}
720
+ collapseText={`Collapse ${label}`}
721
+ >
722
+ <SideBar.Item.Icon icon={icon} />
723
+ <SideBar.Item.Text>{label}</SideBar.Item.Text>
724
+ </SideBar.ExpandableItem.Trigger>
725
+ <SideBar.ExpandableItem.Items>
726
+ {children.map((child) => (
727
+ <SideBar.Item
728
+ key={child}
729
+ isActive={activeLink === child}
730
+ onClick={() => onNavigate(child)}
731
+ tooltipProps={{ text: child, placement: 'right' }}
732
+ >
733
+ <SideBar.Item.Text>{child}</SideBar.Item.Text>
734
+ </SideBar.Item>
735
+ ))}
736
+ </SideBar.ExpandableItem.Items>
737
+ </SideBar.ExpandableItem>
738
+ );
739
+
740
+ const [activeLink, setActiveLink] = useState('Agent Memory');
741
+
742
+ <SideBar isExpanded expandedWidth="24rem" showActiveIndicator={false}>
743
+ <SideBar.ScrollContainer>
744
+ <SideBar.ItemsContainer>
745
+ {sections.map((section) => (
746
+ <Section
747
+ key={section.label}
748
+ {...section}
749
+ activeLink={activeLink}
750
+ onNavigate={setActiveLink}
751
+ />
752
+ ))}
753
+ <SideBar.Item
754
+ isActive={activeLink === 'Settings'}
755
+ onClick={() => setActiveLink('Settings')}
756
+ tooltipProps={{ text: 'Settings', placement: 'right' }}
757
+ >
758
+ <SideBar.Item.Icon icon={SettingsIcon} />
759
+ <SideBar.Item.Text>Settings</SideBar.Item.Text>
760
+ </SideBar.Item>
761
+ </SideBar.ItemsContainer>
762
+ </SideBar.ScrollContainer>
763
+ </SideBar>
764
+ ```
765
+
766
+ ### ExpandableItem States
767
+
768
+ > While a section is closed, its trigger takes the highlight of the active child.
769
+ > In the collapsed rail only triggers show, and their tooltips carry the labels.
770
+
771
+ ```tsx
772
+ // Closed section with an active child: the Iris trigger is highlighted
773
+ <Section {...irisSection} activeLink="Agent Memory" onNavigate={setActiveLink} defaultOpen={false} />
774
+
775
+ // Collapsed rail: nested items are hidden, triggers show with tooltips
776
+ <SideBar isExpanded={false}>...</SideBar>
777
+ ```
778
+
667
779
  ## Notes
668
780
 
669
781
  - `SideBar` is a collapsible navigation shell with a fixed header/footer layout and grouped content in the middle.
@@ -677,7 +789,9 @@ const [expanded, setExpanded] = useState(true);
677
789
  - `SideBar.Item` supports the `isActive` prop for marking the current route or selected item.
678
790
  - `SideBar.Item.Button` defaults its size to `M`.
679
791
  - `SideBar.Button` is the root collapsible action button, and it defaults to `PlusIcon` when no collapsed icon is provided.
792
+ - `SideBar.ExpandableItem` adds one level of nesting. Put `Trigger` and `Items` inside it, and place it in a `SideBar.ItemsContainer` next to regular items.
793
+ - Pass `hasActiveChild` when a nested item is active, so the trigger stays highlighted while the section is closed. Only one row is highlighted at a time.
680
794
  - `SideBar.Group` wraps a section's `Group.Title` (optional) and items so the title and the items stay together as one logical unit.
681
795
  - `SideBar.Group.Title` labels a group of items. Pair `SideBar.Item.Badge` with `Item.Text` if you need to mark individual items as `NEW`, `BETA`, etc.
682
796
  - **Theme Architecture (v17.0.0+)**: The SideBar theme uses a flattened structure where state-dependent theme properties (`collapseButton.border`, `collapseButton.right`, `footer.meta.visibility`, `footer.meta.whiteSpace`) are defined as `{ collapsed: string; expanded: string }` objects directly on the theme. Structural layout values (widths, heights, margins, paddings, gaps, radii, shadows) that don't vary across light/dark themes are defined in `SIDEBAR_CONSTANTS` rather than duplicated in each theme file. This eliminates the need for runtime theme merging and provides full type safety.
683
- - **Optional sizing theme keys**: a theme can set `button.height`, `item.fontSize`, `item.gap`, `item.iconSize`, `item.height`, `item.margin` and `groupTitle.fontSize` to resize the sidebar. `button.height` replaces `SIDEBAR_CONSTANTS.button.height` and also sets the collapsed `SideBar.Button` width, so it stays square. `item.gap`, `item.height` and `item.margin` replace the matching `SIDEBAR_CONSTANTS.item` values (for items and `CollapseButton`), `item.iconSize` replaces the `L` icon size, `item.fontSize` applies to `Item.Text` without a `size` (including `CollapseButton`), and `groupTitle.fontSize` replaces the `S` group title size. Themes that leave them unset keep the defaults; the Next themes set them for Ultra.
797
+ - **Optional sizing theme keys**: a theme can set `button.height`, `item.fontSize`, `item.gap`, `item.iconSize`, `item.height`, `item.margin` and `groupTitle.fontSize` to resize the sidebar. `button.height` replaces `SIDEBAR_CONSTANTS.button.height` and also sets the collapsed `SideBar.Button` width, so it stays square. `item.gap`, `item.height` and `item.margin` replace the matching `SIDEBAR_CONSTANTS.item` values (for items and `CollapseButton`), `item.iconSize` replaces the `L` icon size, `item.fontSize` applies to `Item.Text` without a `size` (including `CollapseButton`), and `groupTitle.fontSize` replaces the `S` group title size. `item.child.height` and `item.child.fontSize` size the items inside `SideBar.ExpandableItem.Items` (defaulting to `2.8rem` and `item.fontSize`). Themes that leave them unset keep the defaults; the Next themes set them for Ultra.