Toggle tabs

PHOTO EMBED

Thu Dec 01 2022 15:56:24 GMT+0000 (Coordinated Universal Time)

Saved by @Marou03 #typescript


 const tabsInAssets = ['Coupe', 'Graph']
 const [tabSelectedIndex, setTabSelectedIndex] = useState<number>(0)

    
// html:    
      { tabsInAssets.map((elem, index) =>
                                    <button key={index} 
                                    className={tabSelectedIndex === index ?
                                        'bg-gray-400 mr-2 w-12 rounded font-Inter font-medium': 
                                        'bg-gray-200 mr-2 w-12 rounded font-Inter font-medium'} 
                                        onClick={() => {setTabSelectedIndex(index) }}>{elem}</button>
                                )}
                                
content_copyCOPY