tabs icon indicating copy to clipboard operation
tabs copied to clipboard

Arrows instead of dropdown for scrollable tabs like in v10

Open rus-yurchenko opened this issue 3 years ago • 10 comments

Hi everyone,

I see that scrollable behavior with arrows has been removed starting v11 of this package. At the same time in the README, the screenshot still exists.

Is it possible to reproduce exactly the same tabs behavior using only arrows like on the demo screenshot?

image

rus-yurchenko avatar Jul 23 '21 08:07 rus-yurchenko

yes i was facing the same issue so i moved to 10v of rc-tabs but the issue with it that in mobile you cant swipe tabs you are forced to use arrows to navigate between tabs so it;s disappointing\ that they removed it in the latest version

Mood-al avatar Dec 16 '21 22:12 Mood-al

same question

notmedia avatar May 09 '22 21:05 notmedia

same question

You can use this component I built it from scratch you can customize everything inside it. and I'm planing to add dropdown to it too like rc-tabs https://www.npmjs.com/package/react-tabs-scrollable

Mood-al avatar May 09 '22 21:05 Mood-al

@Mood-al could you give any example that how can we use react-tabs-scrollable along with rc-tabs

vikasCognext avatar Sep 08 '22 11:09 vikasCognext

@Mood-al could you give any example that how can we use react-tabs-scrollable along with rc-tabs

Hmmmm i really forgot to add one but it's just a dropdown and you can put it next to the tabs container ising css and by using the onchange in select input you can change the state of the active tabs

But anyway I'm not free now maybe after a week i will add this example

Mood-al avatar Sep 09 '22 12:09 Mood-al

@Mood-al i have added that scroll to rc-tabs

export default function ReactScrollTabs(props) {
    const [activeTab, setActiveTab] = useState(0)
    console.log(props)
    let propData = JSON.parse(JSON.stringify(props.data))
    const onTabClick = (e, index) => {
        console.log(e)
        props.currentTab(index)
        setActiveTab(index)
      }
  return (
    
    <Tabs activeTab={activeTab} onTabClick={onTabClick} >
      {/* generating an array to loop through it  */}
      {propData.map((item,ind) => (
        <Tab key={ind}>{item.title}</Tab>
      ))}
    </Tabs>
    
  )
}

<Tabs  activeKey={activeTab} renderTabBar={() => <ReactScrollTabs data={payload} currentTab={ScrollTabs} />} ></Tabs>

using above code you can add scrollbar to existing code.

vikasCognext avatar Sep 09 '22 13:09 vikasCognext

@Mood-al i have added that scroll to rc-tabs

export default function ReactScrollTabs(props) {
    const [activeTab, setActiveTab] = useState(0)
    console.log(props)
    let propData = JSON.parse(JSON.stringify(props.data))
    const onTabClick = (e, index) => {
        console.log(e)
        props.currentTab(index)
        setActiveTab(index)
      }
  return (
    
    <Tabs activeTab={activeTab} onTabClick={onTabClick} >
      {/* generating an array to loop through it  */}
      {propData.map((item,ind) => (
        <Tab key={ind}>{item.title}</Tab>
      ))}
    </Tabs>
    
  )
}

<Tabs  activeKey={activeTab} renderTabBar={() => <ReactScrollTabs data={payload} currentTab={ScrollTabs} />} ></Tabs>

using above code you can add scrollbar to existing code.

Hold on i really didnt get what do you want

Do you want to show scroll bar? Or you want react-tabs-scrollable to look like rc-tabs??

Mood-al avatar Sep 09 '22 13:09 Mood-al

@Mood-al i have added that scroll to rc-tabs

export default function ReactScrollTabs(props) {
    const [activeTab, setActiveTab] = useState(0)
    console.log(props)
    let propData = JSON.parse(JSON.stringify(props.data))
    const onTabClick = (e, index) => {
        console.log(e)
        props.currentTab(index)
        setActiveTab(index)
      }
  return (
    
    <Tabs activeTab={activeTab} onTabClick={onTabClick} >
      {/* generating an array to loop through it  */}
      {propData.map((item,ind) => (
        <Tab key={ind}>{item.title}</Tab>
      ))}
    </Tabs>
    
  )
}

<Tabs  activeKey={activeTab} renderTabBar={() => <ReactScrollTabs data={payload} currentTab={ScrollTabs} />} ></Tabs>

using above code you can add scrollbar to existing code.

Hold on i really didnt get what do you want

Do you want to show scroll bar? Or you want react-tabs-scrollable to look like rc-tabs??

i have added react-tabs-scrollable into rc-tab so i utilize both as i need not to change my current code just added scrollbar using react-tabs-scrollable into renderTabBar props and just pass the active key to rc-tabs

vikasCognext avatar Sep 13 '22 04:09 vikasCognext

@Mood-al i have added that scroll to rc-tabs

export default function ReactScrollTabs(props) {
    const [activeTab, setActiveTab] = useState(0)
    console.log(props)
    let propData = JSON.parse(JSON.stringify(props.data))
    const onTabClick = (e, index) => {
        console.log(e)
        props.currentTab(index)
        setActiveTab(index)
      }
  return (
    
    <Tabs activeTab={activeTab} onTabClick={onTabClick} >
      {/* generating an array to loop through it  */}
      {propData.map((item,ind) => (
        <Tab key={ind}>{item.title}</Tab>
      ))}
    </Tabs>
    
  )
}

<Tabs  activeKey={activeTab} renderTabBar={() => <ReactScrollTabs data={payload} currentTab={ScrollTabs} />} ></Tabs>

using above code you can add scrollbar to existing code.

Hold on i really didnt get what do you want

Do you want to show scroll bar? Or you want react-tabs-scrollable to look like rc-tabs??

i have added react-tabs-scrollable into rc-tab so i utilize both as i need not to change my current code just added scrollbar using react-tabs-scrollable into renderTabBar props and just pass the active key to rc-tabs

I see now but you can totally get rid of rc-tabs and customize react-tabs-scrollable to look as you want usinf just css and a select input . soon enough i will provide an example of that use case

Mood-al avatar Sep 13 '22 08:09 Mood-al

@Mood-al could you give any example that how can we use react-tabs-scrollable along with rc-tabs

hey I created an example to how you can customize react-tabs-scrollable to look like rc-tabs . u can check it out from here https://codesandbox.io/s/react-tabs-scrollable-rc-tabs-like-example-lrbt2j

Mood-al avatar Sep 27 '22 18:09 Mood-al