J'utilise material UI, material-ui/Tabs
Un exemple de code comme celui-ci...
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import AppBar from 'material-ui/AppBar'
import Tabs, { Tab } from 'material-ui/Tabs';
import Typography from 'material-ui/Typography';
const styles = theme => ({
bigIndicator: {
height: 5,
},
});
class BasicTabs extends React.Component {
state = { value: 0 }
handleChange = (event, value) => {
this.setState({ value });
};
render() {
const { classes } = this.props;
const {value} = this.state
return [
<AppBar position="static" key="appbar">
<Tabs
classes={{ indicator: classes.bigIndicator }}
value={value}
onChange={this.handleChange}
>
<Tab label="T1 Label 1" />
<Tab label="T2 Label 1" />
<Tab label="T3 Label 1" />
</Tabs>
</AppBar>,
<div key="tab-content">
{value === 0 && <Typography>Item One</Typography>}
{value === 1 && <Typography>Item Two</Typography>}
{value === 2 && <Typography>Item Three</Typography>}
</div>
]
}
}
BasicTabs.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(BasicTabs);
Mais je veux ajouter l'étiquette 2 dans chaque onglet pour que cela ressemble à ceci...
C'est mon Exemple codesandbox https://codesandbox.io/s/xjj5j6284
Merci d'avance.