Recommended pattern for styling active tabs in v1?
See original GitHub issueI know the tracker says questions will be closed, but since this is a change from v0
to v1
I felt this was still the appropriate place for this question.
In v0
the selected tab got an active
class assigned to it in the DOM, which I was using. This was definitely not the best way to do things and I’m grateful for v1
, but a bit confused about how to replicate that.
In emotion
without reakit
the pattern would be something like:
const StyledTab = styled.div(props => {
return { color: props.currentId === props.selectedId ? "red" : "black" };
});
I’m not sure how that would translate to usage with reakit
where I’ve got something like:
const StyledTab = styled(Tab)`
// How can we access props here? Or is there some better pattern I'm overlooking?
`
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Tabs | UI Design & Patterns - MindSphere Design System
Horizontal tabs are best used with ten or fewer tabs. Pay attention to the legibility of tab ... The icon color and style...
Read more >Example of Tabs with Automatic Activation | APG | WAI - W3C
This example section demonstrates a tabs widget that implements the design pattern for tabs. In this example, a tab is automatically ...
Read more >How to change active tab color in MUI? - reactjs - Stack Overflow
Configure your theme palette to use your desired color via the primary or secondary color intentions. You may then specify your desired primary ......
Read more >Tabs - OutSystems 11 Documentation
You can use the Tabs UI Pattern to display large sets of information, which can be split into different areas, while always remaining...
Read more >Tabs - a Collection by Team CodePen on CodePen
One of the most design pattern-y-est design patterns of all the design patterns. Share Copy Link. Created on: September 11, 2014.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Slapbox!
You can rely on aria attributes: https://github.com/reakit/reakit/blob/8837557636432cd7c6202a67e5d7d2ad5fdd4db6/packages/reakit-system-bootstrap/src/Tab.ts#L27-L30
You can also use
reakit-system-bootstrap
implementation as a styling reference. It also uses emotion. 😃I’m glad to hear that! 😃
And I’m sorry about the migration pain. But, yeah, that’s a huge improvement and a lot of effort has been made to make the v1 much more consistent and more likely to be adopted by big enterprise apps (I’m working on one). It shouldn’t change too much even on future major versions.