Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrows instead of dropdown for scrollable tabs like in v10 #410

Open
rus-yurchenko opened this issue Jul 23, 2021 · 10 comments
Open

Arrows instead of dropdown for scrollable tabs like in v10 #410

rus-yurchenko opened this issue Jul 23, 2021 · 10 comments

Comments

@rus-yurchenko
Copy link

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 rus-yurchenko changed the title Arrows instead of dropdown like in v10 Arrows instead of dropdown for scrollable tabs like in v10 Jul 23, 2021
@Mood-al
Copy link

Mood-al commented Dec 16, 2021

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

@notmedia
Copy link

notmedia commented May 9, 2022

same question

@Mood-al
Copy link

Mood-al commented May 9, 2022

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

@vikasCognext
Copy link

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

@Mood-al
Copy link

Mood-al commented Sep 9, 2022

@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

@vikasCognext
Copy link

vikasCognext commented Sep 9, 2022

@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.

@Mood-al
Copy link

Mood-al commented Sep 9, 2022

@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??

@vikasCognext
Copy link

@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

@Mood-al
Copy link

Mood-al commented Sep 13, 2022

@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
Copy link

Mood-al commented Sep 27, 2022

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants