question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve Tab Props

See original GitHub issue

Tab is a nice addition. The problem I’m having is that I want to pass props to my tab panes (render functions). To do this I’m doing <Tab panes={panes} foo="foo" />, which returns Unknown prop foo on <div> tag. Remove this prop from the element. For details, see. Can we have a new prop, like paneProps that we use just for the render props?

Also, can we have <Tab /> take in Tab.Pane children in addition to a panes list prop?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
layershiftercommented, Jul 14, 2017

You have this warning because unhandled props are passed to the root element of Tab, it’s a div in this case. Can you clarify your needs? Why you can’t use this approach?

const paneProps = { foo: 'foo' }
const panes = [
  { menuItem: 'Tab 1', render: () => <Tab.Pane {...paneProps}>Tab 1 Content</Tab.Pane> },
  { menuItem: 'Tab 2', render: () => <Tab.Pane {...paneProps}>Tab 2 Content</Tab.Pane> },
]

const TabExampleBasic = () => (
  <Tab panes={panes} />
)

I’m pretty sure that the new prop isn’t required.

1reaction
levithomasoncommented, Aug 27, 2017

@EdsonAlcala create the const panes = [] within Profile component. This way, you can pass any of the connected data to the panes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Simplest Way To Create A Reusable Tab Or ... - Medium
A simple tab realization can bring a huge UX improvement, being one of the best ways to avoid unnecessary routes or pages.
Read more >
How to Build a Tabs Component with React - DigitalOcean
Tabs are a common UI component and are important to understand how to implement. In this article you will learn how to build...
Read more >
How to change tab using props for material ui tabs?
The tabs has a value property , that indicates whether a tab has to be open or not: <Tabs value={value} onChange={handleChange} ...
Read more >
How to build a tab component in React - LogRocket Blog
Learn how to build a tab component in React, an essential detail for React apps that provide a clean and organized view for...
Read more >
How To Style MUI Tabs and Tab Indicator - YouTube
Do you want to build a full MUI app from beginning to end, learn every aspect of the sx prop, styled API, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found