Looking at this example: Link to Material UI Tabs
If I have a these tabs components in a widget, and if I want to have an image or icon, how would I be able to link the icon or image so that on click it would change to the tab I want it to change to? And I am not using react-router or anything.
Any directions to this would be helpful, whether to be passing a prop or something.
The tabs has a value
property , that indicates whether a tab has to be open or not:
<Tabs value={value} onChange={handleChange} aria-label="simple tabs example">
You need to add this handleChange
method to the icon or image that you want to use as a button
.
Maybe add some code to see if is that simple or you need to pass your method
to other component
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.