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.

className props should apply CSS class in any state

See original GitHub issue

I know, this is the breaking change and can’t apply immediately. When this project will drastic change at v3.0 please consider following proposal.

Currently, this component can receive className and openedClassName.

  • className: class name for CLOSED component
  • openedClassName: class name for opened component

Generally className prop is known as that to specify class attribute always, like <div> element in the react. https://reactjs.org/docs/dom-elements.html#classname

Current behavior has given some surprising and annoying for me. IMO, following three props are LGTM.

  • className: class name without condition
  • closedClassName: class name for closed component
  • openedClassName: class name for opened component

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
karltaylorcommented, Feb 25, 2019

Fixed in v3.0.0

0reactions
iMoses-Apiirocommented, Jul 6, 2022

@glennflanagan I’m more inline with what @karltaylor suggested, which is not dealing only with this specific request but taking the package to the next level. Basically a maintenance refactor to account for all changes in the ecosystem (hooks, modern design patterns, etc).

Although I’m personally not in favor of adding css-in-js as I think it’s too opinionated and what I love about this package is that it’s so small and doesn’t have dependencies 😃

If working hands are the issue then I can quickly wrap something up for a PR, but is it something you’d be interested in? Keeping the exact same logic but rewriting the entire API for a new major version

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set the ClassName with state value in modular css in react
This would help you add the className this way. Variable is any variable in state with classname
Read more >
Styling and CSS - React
Pass a string as the className prop: ... It is common for CSS classes to depend on the component props or state: ......
Read more >
Applying React Conditional classNames - Pluralsight
Not only can you use props to conditionally apply class names, but you can also use state and other derived values.
Read more >
Styles - React Select
Examples. Styles. React Select offers 3 main APIs for styling: The styles prop; The classNames prop; The classNamePrefix prop. The styles prop.
Read more >
How To Style React Components | DigitalOcean
In this tutorial, you'll learn three different ways to style React components: plain Cascading Style Sheets (CSS), inline styles with ...
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