Skip to content

Commit 8bbd5f9

Browse files
authored
Merge pull request #3484 from plotly/feature/dcc-refactor-tabs
dcc redesign: tabs
2 parents 42a38ac + 2075e5b commit 8bbd5f9

File tree

18 files changed

+661
-551
lines changed

18 files changed

+661
-551
lines changed

@plotly/dash-generator-test-component-typescript/generator.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ describe('Test Typescript component metadata generation', () => {
9595
`${componentName} element JSX.Element`,
9696
testTypeFactory('element', 'node')
9797
);
98+
test(
99+
`${componentName} dash_component DashComponent`,
100+
testTypeFactory("dash_component", "node"),
101+
);
98102
test(
99103
`${componentName} boolean type`,
100104
testTypeFactory('a_bool', 'bool')

@plotly/dash-generator-test-component-typescript/src/props.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// Needs to export types if not in a d.ts file or if any import is present in the d.ts
22
import React from 'react';
33

4+
type DashComponent = {
5+
props: string;
6+
namespace: string;
7+
children?: [];
8+
}
9+
410

511
type Nested = {
612
nested: Nested;
@@ -36,6 +42,7 @@ export type TypescriptComponentProps = {
3642
| boolean;
3743
element?: JSX.Element;
3844
array_elements?: JSX.Element[];
45+
dash_component?: DashComponent;
3946

4047
string_default?: string;
4148
number_default?: number;

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## UNRELEASED
6+
7+
## Added
8+
- Modernized `dcc.Tabs`
9+
10+
## Changed
11+
- `dcc.Tab` now accepts a `width` prop which can be a pixel or percentage width for an individual tab.
12+
- `dcc.Tab` can accept other Dash Components for its label, in addition to a simple string.
13+
514
## [4.0.0rc2] - 2025-10-10
615

716
## Added

components/dash-core-components/src/components/Tab.react.js

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import './css/tabs.css';
3+
import {TabProps} from '../types';
4+
5+
/**
6+
* Part of dcc.Tabs - this is the child Tab component used to render a tabbed page.
7+
* Its children will be set as the content of that tab, which if clicked will become visible.
8+
*/
9+
function Tab({
10+
children,
11+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12+
disabled = false,
13+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
14+
disabled_style = {color: 'var(--Dash-Text-Disabled)'},
15+
}: TabProps) {
16+
return <>{children}</>;
17+
}
18+
19+
export default Tab;

0 commit comments

Comments
 (0)