@redis-ui/components 43.0.2 → 43.2.1
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.
- package/dist/HighlightedIcon/HighlightedIcon.cjs +26 -0
- package/dist/HighlightedIcon/HighlightedIcon.d.ts +3 -0
- package/dist/HighlightedIcon/HighlightedIcon.js +26 -0
- package/dist/HighlightedIcon/HighlightedIcon.style.cjs +49 -0
- package/dist/HighlightedIcon/HighlightedIcon.style.d.ts +5 -0
- package/dist/HighlightedIcon/HighlightedIcon.style.js +47 -0
- package/dist/HighlightedIcon/HighlightedIcon.types.d.ts +8 -0
- package/dist/HighlightedIcon/index.d.ts +3 -0
- package/dist/Stepper/Stepper.cjs +14 -5
- package/dist/Stepper/Stepper.d.ts +2 -0
- package/dist/Stepper/Stepper.js +14 -5
- package/dist/Stepper/Stepper.utils.cjs +12 -0
- package/dist/Stepper/Stepper.utils.d.ts +2 -0
- package/dist/Stepper/Stepper.utils.js +12 -0
- package/dist/Stepper/components/Compose/Compose.d.ts +1 -0
- package/dist/Stepper/components/Step/Step.cjs +2 -0
- package/dist/Stepper/components/Step/Step.d.ts +1 -0
- package/dist/Stepper/components/Step/Step.js +2 -0
- package/dist/Stepper/components/Step/components/Compose/Compose.cjs +2 -9
- package/dist/Stepper/components/Step/components/Compose/Compose.js +2 -9
- package/dist/Stepper/components/Step/components/Separator/Separator.cjs +15 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.d.ts +3 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.js +15 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.style.cjs +24 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.style.d.ts +1 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.style.js +22 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.types.d.ts +5 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +74 -70
- package/package.json +2 -2
- package/skills/redis-ui-components/SKILL.md +0 -2
- package/skills/redis-ui-components/references/ActionIconButton.md +96 -0
- package/skills/redis-ui-components/references/AppBar.md +161 -0
- package/skills/redis-ui-components/references/AppSelectionMenu.md +184 -0
- package/skills/redis-ui-components/references/AutoCompleteSelect.md +193 -0
- package/skills/redis-ui-components/references/Badge.md +77 -0
- package/skills/redis-ui-components/references/Banner.md +563 -0
- package/skills/redis-ui-components/references/BoxSelectionGroup.md +487 -0
- package/skills/redis-ui-components/references/Breadcrumbs.md +214 -0
- package/skills/redis-ui-components/references/ButtonGroup.md +126 -0
- package/skills/redis-ui-components/references/Card.md +56 -0
- package/skills/redis-ui-components/references/Checkbox.md +171 -0
- package/skills/redis-ui-components/references/Chip.md +154 -0
- package/skills/redis-ui-components/references/ChipList.md +307 -0
- package/skills/redis-ui-components/references/CopyToClipboardButton.md +47 -0
- package/skills/redis-ui-components/references/CountryFlag.md +57 -0
- package/skills/redis-ui-components/references/Drawer.md +298 -0
- package/skills/redis-ui-components/references/Filters.md +162 -0
- package/skills/redis-ui-components/references/FormField.md +678 -0
- package/skills/redis-ui-components/references/IconButton.md +63 -0
- package/skills/redis-ui-components/references/Input.md +295 -0
- package/skills/redis-ui-components/references/KeyValueList.md +501 -0
- package/skills/redis-ui-components/references/Label.md +238 -0
- package/skills/redis-ui-components/references/Link.md +402 -0
- package/skills/redis-ui-components/references/Loader.md +100 -0
- package/skills/redis-ui-components/references/Menu.md +988 -0
- package/skills/redis-ui-components/references/MidBar.md +358 -0
- package/skills/redis-ui-components/references/Modal.md +525 -0
- package/skills/redis-ui-components/references/MoreInfoIcon.md +119 -0
- package/skills/redis-ui-components/references/MultiSelect.md +558 -0
- package/skills/redis-ui-components/references/NumericInput.md +322 -0
- package/skills/redis-ui-components/references/Overflow.md +127 -0
- package/skills/redis-ui-components/references/Pagination.md +151 -0
- package/skills/redis-ui-components/references/PasswordInput.md +262 -0
- package/skills/redis-ui-components/references/Popover.md +868 -0
- package/skills/redis-ui-components/references/ProfileIcon.md +65 -0
- package/skills/redis-ui-components/references/ProgressBar.md +103 -0
- package/skills/redis-ui-components/references/QuantityCounter.md +555 -0
- package/skills/redis-ui-components/references/RadioGroup.md +265 -0
- package/skills/redis-ui-components/references/ScreenReaderAnnounce.md +147 -0
- package/skills/redis-ui-components/references/SearchBar.md +242 -0
- package/skills/redis-ui-components/references/SearchInput.md +213 -0
- package/skills/redis-ui-components/references/Section.md +349 -0
- package/skills/redis-ui-components/references/SideBar.md +468 -0
- package/skills/redis-ui-components/references/Slider.md +398 -0
- package/skills/redis-ui-components/references/Stepper.md +288 -0
- package/skills/redis-ui-components/references/Switch.md +193 -0
- package/skills/redis-ui-components/references/Tabs.md +383 -0
- package/skills/redis-ui-components/references/TextArea.md +139 -0
- package/skills/redis-ui-components/references/TextButton.md +217 -0
- package/skills/redis-ui-components/references/Toast.md +399 -0
- package/skills/redis-ui-components/references/ToggleButton.md +163 -0
- package/skills/redis-ui-components/references/Tooltip.md +636 -0
- package/skills/redis-ui-components/references/Typography.md +323 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
# MidBar
|
|
2
|
+
|
|
3
|
+
A navigation mid-bar that combines optional start/middle/end groups with tab navigation and a shared `Tabs` composition state.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { MidBar } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
### `MidBar`
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
|------|------|---------|-------------|
|
|
17
|
+
| tabs | `TTab[]` | - | Tab trigger/content items rendered by the header and content pane. |
|
|
18
|
+
| startGroup | `ReactNode` | - | Content rendered in the start slot of the header. |
|
|
19
|
+
| middleGroup | `ReactNode` | - | Content rendered in the middle slot when no tabs are provided. |
|
|
20
|
+
| endGroup | `ReactNode` | - | Content rendered in the end slot of the header. |
|
|
21
|
+
| defaultValue | `NoInfer<TValue>` | - | Initial active tab value for the shared compose state. |
|
|
22
|
+
| value | `NoInfer<TValue>` | - | Controlled active tab value. |
|
|
23
|
+
| onChange | `(newValue: TValue) => void` | - | Called when the active tab changes. |
|
|
24
|
+
| activateOnFocus | `boolean` | `false` | Activates a tab as soon as it receives focus. |
|
|
25
|
+
|
|
26
|
+
`MidBar` also accepts the shared state props from `MidBar.Compose` through the internal `Tabs.Compose` wrapper.
|
|
27
|
+
|
|
28
|
+
### `MidBar.Compose`
|
|
29
|
+
|
|
30
|
+
| Prop | Type | Default | Description |
|
|
31
|
+
|------|------|---------|-------------|
|
|
32
|
+
| defaultValue | `NoInfer<TValue>` | - | Initial active tab value for the shared compose state. |
|
|
33
|
+
| value | `NoInfer<TValue>` | - | Controlled active tab value. |
|
|
34
|
+
| onChange | `(newValue: TValue) => void` | - | Called when the active tab changes. |
|
|
35
|
+
| activateOnFocus | `boolean` | `false` | Activates a tab as soon as it receives focus. |
|
|
36
|
+
| children | `ReactNode` | required | Custom header and content layout built from the compound parts. |
|
|
37
|
+
| compose wrapper props | `ComposeElementProps` | - | Standard wrapper props inherited from `Tabs.Compose`. |
|
|
38
|
+
|
|
39
|
+
### `MidBar.Header`
|
|
40
|
+
|
|
41
|
+
| Prop | Type | Default | Description |
|
|
42
|
+
|------|------|---------|-------------|
|
|
43
|
+
| tabs | `TabTriggerInfo[]` | - | Tab trigger metadata rendered by the header tab bar. |
|
|
44
|
+
| startGroup | `ReactNode` | - | Start-slot content for the header. |
|
|
45
|
+
| middleGroup | `ReactNode` | - | Middle-slot content when tabs are not provided. |
|
|
46
|
+
| endGroup | `ReactNode` | - | End-slot content for the header. |
|
|
47
|
+
| compose wrapper props | `ComposeElementProps` | - | Standard header wrapper props without `children`. |
|
|
48
|
+
|
|
49
|
+
`MidBar.Header` is a convenience wrapper around `MidBar.Header.Compose`, `MidBar.Header.Group`, and `MidBar.Header.TabBar`.
|
|
50
|
+
|
|
51
|
+
### `MidBar.Header.Compose`
|
|
52
|
+
|
|
53
|
+
| Prop | Type | Default | Description |
|
|
54
|
+
|------|------|---------|-------------|
|
|
55
|
+
| children | `ReactNode` | required | Custom header layout. |
|
|
56
|
+
| compose wrapper props | `ComposeElementProps` | - | Standard header container props. |
|
|
57
|
+
|
|
58
|
+
### `MidBar.Header.Group`
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Default | Description |
|
|
61
|
+
|------|------|---------|-------------|
|
|
62
|
+
| position | `'start' \| 'middle' \| 'end'` | required | Header slot position. |
|
|
63
|
+
| children | `ReactNode` | required | Group content rendered in the selected header slot. |
|
|
64
|
+
| compose wrapper props | `ComposeElementProps` | - | Standard group container props. |
|
|
65
|
+
|
|
66
|
+
### `MidBar.Header.TabBar`
|
|
67
|
+
|
|
68
|
+
| Prop | Type | Default | Description |
|
|
69
|
+
|------|------|---------|-------------|
|
|
70
|
+
| tabs | `TabTriggerInfo[]` | required | Tabs rendered as header triggers. |
|
|
71
|
+
| variant | `'default' \| 'sub'` | `'default'` | Tab bar visual variant. |
|
|
72
|
+
| compose wrapper props | `ComposeElementProps` | - | Standard tab bar container props. |
|
|
73
|
+
|
|
74
|
+
`MidBar.Header.TabBar` reuses the `Tabs.TabBar` implementation, including `Trigger`, `Trigger.Compose`, `Trigger.Tab`, and `Trigger.Marker`.
|
|
75
|
+
|
|
76
|
+
### `MidBar.ContentPane`
|
|
77
|
+
|
|
78
|
+
| Prop | Type | Default | Description |
|
|
79
|
+
|------|------|---------|-------------|
|
|
80
|
+
| tabs | `TabContentInfo[]` | required | Content panes rendered for each tab. |
|
|
81
|
+
| compose wrapper props | `ComposeElementProps` | - | Standard content pane container props. |
|
|
82
|
+
|
|
83
|
+
`MidBar.ContentPane` reuses the `Tabs.ContentPane` implementation, including `Compose` and `Content`.
|
|
84
|
+
|
|
85
|
+
### `MidBar.ContentPane.Compose`
|
|
86
|
+
|
|
87
|
+
| Prop | Type | Default | Description |
|
|
88
|
+
|------|------|---------|-------------|
|
|
89
|
+
| children | `ReactNode` | required | Custom content pane layout. |
|
|
90
|
+
| compose wrapper props | `ComposeElementProps` | - | Standard content pane container props. |
|
|
91
|
+
|
|
92
|
+
### `MidBar.ContentPane.Content`
|
|
93
|
+
|
|
94
|
+
| Prop | Type | Default | Description |
|
|
95
|
+
|------|------|---------|-------------|
|
|
96
|
+
| value | `string` | required | Tab value linked to the content panel. |
|
|
97
|
+
| children | `ReactNode` | required | Content rendered inside the panel. |
|
|
98
|
+
| compose wrapper props | `ComposeElementProps<HTMLDivElement>` | - | Standard content panel props. |
|
|
99
|
+
|
|
100
|
+
## Sub-components
|
|
101
|
+
|
|
102
|
+
- `MidBar.Compose` - Shared tab state wrapper used for custom layouts.
|
|
103
|
+
- `MidBar.Header` - Convenience wrapper for the header slots and tab bar.
|
|
104
|
+
- `MidBar.Header.Compose` - Header layout container.
|
|
105
|
+
- `MidBar.Header.Group` - Positioned header slot container for start, middle, or end content.
|
|
106
|
+
- `MidBar.Header.TabBar` - Tab bar alias built on `Tabs.TabBar`.
|
|
107
|
+
- `MidBar.Header.TabBar.Compose` - Custom tab bar layout container.
|
|
108
|
+
- `MidBar.Header.TabBar.Trigger` - Single tab trigger wrapper.
|
|
109
|
+
- `MidBar.Header.TabBar.Trigger.Compose` - Custom trigger container.
|
|
110
|
+
- `MidBar.Header.TabBar.Trigger.Tab` - Trigger label container.
|
|
111
|
+
- `MidBar.Header.TabBar.Trigger.Marker` - Trigger state marker.
|
|
112
|
+
- `MidBar.ContentPane` - Content pane alias built on `Tabs.ContentPane`.
|
|
113
|
+
- `MidBar.ContentPane.Compose` - Custom content pane layout container.
|
|
114
|
+
- `MidBar.ContentPane.Content` - Individual tab content panel.
|
|
115
|
+
|
|
116
|
+
## Examples
|
|
117
|
+
|
|
118
|
+
### Playground
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { MidBar, Button } from '@redislabsdev/redis-ui-components';
|
|
122
|
+
|
|
123
|
+
const tabs = [
|
|
124
|
+
{ value: 'tab1', label: 'First Tab', content: 'First Tab Content' },
|
|
125
|
+
{ value: 'tab2', label: 'Second Tab', content: 'Second Tab Content' },
|
|
126
|
+
{
|
|
127
|
+
value: 'tab3',
|
|
128
|
+
label: 'Third Tab (disabled)',
|
|
129
|
+
content: 'Third Tab Content',
|
|
130
|
+
disabled: true
|
|
131
|
+
}
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
<MidBar
|
|
135
|
+
tabs={tabs}
|
|
136
|
+
defaultValue={tabs[0].value}
|
|
137
|
+
startGroup={<div>Databases</div>}
|
|
138
|
+
endGroup={<Button>Create database</Button>}
|
|
139
|
+
/>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### WithoutTabs
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import { MidBar, Button } from '@redislabsdev/redis-ui-components';
|
|
146
|
+
|
|
147
|
+
<MidBar startGroup={<div>Databases</div>} endGroup={<Button>Create database</Button>} />
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### WithTabs
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { useState } from 'react';
|
|
154
|
+
import { MidBar, Button } from '@redislabsdev/redis-ui-components';
|
|
155
|
+
|
|
156
|
+
const tabs = [
|
|
157
|
+
{ value: 'tab1', label: 'First Tab', content: 'First Tab Content' },
|
|
158
|
+
{ value: 'tab2', label: 'Second Tab', content: 'Second Tab Content' },
|
|
159
|
+
{
|
|
160
|
+
value: 'tab3',
|
|
161
|
+
label: 'Third Tab (disabled)',
|
|
162
|
+
content: 'Third Tab Content',
|
|
163
|
+
disabled: true
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
function Example() {
|
|
168
|
+
const [selectedTab, setSelectedTab] = useState(tabs[0].value);
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<MidBar
|
|
172
|
+
tabs={tabs}
|
|
173
|
+
value={selectedTab}
|
|
174
|
+
onChange={setSelectedTab}
|
|
175
|
+
startGroup={<div>Databases</div>}
|
|
176
|
+
endGroup={<Button>Create database</Button>}
|
|
177
|
+
/>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### TabsOnly
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
import { useState } from 'react';
|
|
186
|
+
import { MidBar } from '@redislabsdev/redis-ui-components';
|
|
187
|
+
|
|
188
|
+
const tabs = [
|
|
189
|
+
{ value: 'tab1', label: 'First Tab', content: 'First Tab Content' },
|
|
190
|
+
{ value: 'tab2', label: 'Second Tab', content: 'Second Tab Content' },
|
|
191
|
+
{
|
|
192
|
+
value: 'tab3',
|
|
193
|
+
label: 'Third Tab (disabled)',
|
|
194
|
+
content: 'Third Tab Content',
|
|
195
|
+
disabled: true
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
function Example() {
|
|
200
|
+
const [selectedTab, setSelectedTab] = useState(tabs[0].value);
|
|
201
|
+
|
|
202
|
+
return <MidBar tabs={tabs} value={selectedTab} onChange={setSelectedTab} />;
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### MiddleGroupOnly
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import { MidBar } from '@redislabsdev/redis-ui-components';
|
|
210
|
+
|
|
211
|
+
<MidBar middleGroup={<div>Middle</div>} />;
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### StartAndMiddleGroupOnly
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
import { MidBar } from '@redislabsdev/redis-ui-components';
|
|
218
|
+
|
|
219
|
+
<MidBar startGroup={<div>Start</div>} middleGroup={<div>Middle</div>} />;
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### WithCustomMiddleGroup
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { MidBar, Button } from '@redislabsdev/redis-ui-components';
|
|
226
|
+
|
|
227
|
+
<MidBar
|
|
228
|
+
startGroup={<div>Databases</div>}
|
|
229
|
+
middleGroup={<div>Middle</div>}
|
|
230
|
+
endGroup={<Button>Create database</Button>}
|
|
231
|
+
/>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### HeaderAndContentPane
|
|
235
|
+
|
|
236
|
+
> MidBar component can be shallow composed using 2 main parts:
|
|
237
|
+
> - `MidBar.Header` for rendering header with tabs and groups
|
|
238
|
+
> - `MidBar.ContentPane` for rendering content
|
|
239
|
+
>
|
|
240
|
+
> State management props should be passed to `MidBar.Compose`
|
|
241
|
+
>
|
|
242
|
+
> All parts can have custom styling
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import { MidBar, Button } from '@redislabsdev/redis-ui-components';
|
|
246
|
+
|
|
247
|
+
const tabs = [
|
|
248
|
+
{ value: 'tab1', label: 'First Tab', content: 'First Tab Content' },
|
|
249
|
+
{ value: 'tab2', label: 'Second Tab', content: 'Second Tab Content' },
|
|
250
|
+
{
|
|
251
|
+
value: 'tab3',
|
|
252
|
+
label: 'Third Tab (disabled)',
|
|
253
|
+
content: 'Third Tab Content',
|
|
254
|
+
disabled: true
|
|
255
|
+
}
|
|
256
|
+
];
|
|
257
|
+
|
|
258
|
+
<MidBar.Compose defaultValue={tabs[0].value}>
|
|
259
|
+
<MidBar.Header
|
|
260
|
+
tabs={tabs}
|
|
261
|
+
startGroup={<div>Databases</div>}
|
|
262
|
+
endGroup={<Button>Create database</Button>}
|
|
263
|
+
/>
|
|
264
|
+
|
|
265
|
+
<MidBar.ContentPane tabs={tabs} />
|
|
266
|
+
</MidBar.Compose>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### HeaderComposition
|
|
270
|
+
|
|
271
|
+
> The `MidBar.Header` can be deeply composed using:
|
|
272
|
+
> - `MidBar.Header.Compose` as the main container
|
|
273
|
+
> - `MidBar.Header.Group` for start/middle/end groups
|
|
274
|
+
> - `MidBar.Header.TabBar.Compose` for custom tab bar composition
|
|
275
|
+
>
|
|
276
|
+
> This allows full control over the header layout and styling
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
import { MidBar, Button } from '@redislabsdev/redis-ui-components';
|
|
280
|
+
|
|
281
|
+
const tabs = [
|
|
282
|
+
{ value: 'tab1', label: 'First Tab', content: 'First Tab Content' },
|
|
283
|
+
{ value: 'tab2', label: 'Second Tab', content: 'Second Tab Content' },
|
|
284
|
+
{
|
|
285
|
+
value: 'tab3',
|
|
286
|
+
label: 'Third Tab (disabled)',
|
|
287
|
+
content: 'Third Tab Content',
|
|
288
|
+
disabled: true
|
|
289
|
+
}
|
|
290
|
+
];
|
|
291
|
+
|
|
292
|
+
<MidBar.Compose defaultValue={tabs[0].value}>
|
|
293
|
+
<MidBar.Header.Compose>
|
|
294
|
+
<MidBar.Header.Group position="start">Databases</MidBar.Header.Group>
|
|
295
|
+
<MidBar.Header.TabBar.Compose>
|
|
296
|
+
{tabs.map(({ value, label, disabled }) => (
|
|
297
|
+
<MidBar.Header.TabBar.Trigger.Compose key={value} value={value} disabled={disabled}>
|
|
298
|
+
<MidBar.Header.TabBar.Trigger.Tab>{label ?? value}</MidBar.Header.TabBar.Trigger.Tab>
|
|
299
|
+
<MidBar.Header.TabBar.Trigger.Marker />
|
|
300
|
+
</MidBar.Header.TabBar.Trigger.Compose>
|
|
301
|
+
))}
|
|
302
|
+
</MidBar.Header.TabBar.Compose>
|
|
303
|
+
<MidBar.Header.Group position="end">
|
|
304
|
+
<Button>Create database</Button>
|
|
305
|
+
</MidBar.Header.Group>
|
|
306
|
+
</MidBar.Header.Compose>
|
|
307
|
+
|
|
308
|
+
<MidBar.ContentPane tabs={tabs} />
|
|
309
|
+
</MidBar.Compose>
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### ContentPaneComposition
|
|
313
|
+
|
|
314
|
+
> The `MidBar.ContentPane` can be composed using:
|
|
315
|
+
> - `MidBar.ContentPane.Compose` as the main container
|
|
316
|
+
> - `MidBar.ContentPane.Content` for individual tab content
|
|
317
|
+
>
|
|
318
|
+
> This allows custom styling for each content section
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
import { MidBar, Button } from '@redislabsdev/redis-ui-components';
|
|
322
|
+
|
|
323
|
+
const tabs = [
|
|
324
|
+
{ value: 'tab1', label: 'First Tab', content: 'First Tab Content' },
|
|
325
|
+
{ value: 'tab2', label: 'Second Tab', content: 'Second Tab Content' },
|
|
326
|
+
{
|
|
327
|
+
value: 'tab3',
|
|
328
|
+
label: 'Third Tab (disabled)',
|
|
329
|
+
content: 'Third Tab Content',
|
|
330
|
+
disabled: true
|
|
331
|
+
}
|
|
332
|
+
];
|
|
333
|
+
|
|
334
|
+
<MidBar.Compose defaultValue={tabs[0].value}>
|
|
335
|
+
<MidBar.Header
|
|
336
|
+
tabs={tabs}
|
|
337
|
+
startGroup={<div>Databases</div>}
|
|
338
|
+
endGroup={<Button>Create database</Button>}
|
|
339
|
+
/>
|
|
340
|
+
|
|
341
|
+
<MidBar.ContentPane.Compose>
|
|
342
|
+
{tabs.map(({ value, content }) => (
|
|
343
|
+
<MidBar.ContentPane.Content key={value} value={value}>
|
|
344
|
+
<div style={{ padding: '20px', background: '#f5f5f5' }}>{content}</div>
|
|
345
|
+
</MidBar.ContentPane.Content>
|
|
346
|
+
))}
|
|
347
|
+
</MidBar.ContentPane.Compose>
|
|
348
|
+
</MidBar.Compose>
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Notes
|
|
352
|
+
|
|
353
|
+
- `MidBar` is a compound wrapper around `Tabs.Compose`, `Tabs.ContentPane`, and the custom `MidBar.Header` layout.
|
|
354
|
+
- `MidBar.Header` automatically switches between the tab bar and the middle group depending on whether `tabs` are provided.
|
|
355
|
+
- `MidBar.Header.TabBar` and `MidBar.ContentPane` reuse the corresponding `Tabs` building blocks.
|
|
356
|
+
- The shallow composition story uses `MidBar.Compose` to keep shared tab state in one place.
|
|
357
|
+
- The header composition story uses `MidBar.Header.Compose`, `MidBar.Header.Group`, and `MidBar.Header.TabBar.Compose` for full layout control.
|
|
358
|
+
- The content pane composition story uses `MidBar.ContentPane.Compose` and `MidBar.ContentPane.Content` for custom panel rendering.
|