reactjs / reactjs/react-tabs

styled-components don't work with Tab.js

Open
#148 12 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.1k
Forks
455
Avg merge
5h 9m
Merged PRs (30d)
2

Description

It's not possible to customize Tab.js with styled-components (https://github.com/styled-components/styled-components) because of this line in Tab.js:

if (child.type !== _Tab2.default) {
  return child;
}

if you customize the styling with styled-components,

const StyleTab = styled(Tab)`
    background-color : ${props => props.selected? 'white' : 'transparent'};
`;

child.type will no longer be Tab but StyleTab

I also don't understand why this check is here?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Tab.js at the child.type check described in the report, then reproduce the styled-components example to understand how customized tabs are handled. Done means styled Tab components can be customized without being rejected, while the existing tab behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.