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.

Pass styleConfig part styles to custom ClassName props

See original GitHub issue

Feature request

Is your feature request related to a problem? Please describe.

I am trying to style a component from an external library using Chakra multipart component theming, the component has multiple className props for each of it’s part I want to pass the part styles from the styleConfig to the part className.

Describe the solution you’d like

I want to be able to do something similar to this

export const CustomComponent= () => {
    const styles = useStyleConfig('CustomComponent', {});
    return (
        <ExternalComponent 
          className={styles.container}
          wrapperClassName={styles.wrapper}
          // or 
          otherClassName={sx(styles.other)}  />
    );
};

Is this already possible? if so maybe we could add this to the docs.

If it’s not, what is the recommended alternative?

Describe alternatives you’ve considered

I can just write CSS classNames but I wanted to use the design tokens from the theme

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
ruddi10commented, Jun 15, 2021
 Hey its working now I replaced $.class with .class
1reaction
hazem3500commented, Nov 27, 2020

I’ve ended up doing what @TheThirdRace suggested above, forgot to close the issue though 😅.

Thanks @TheThirdRace & @with-heart

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to include styles in React create portal - Stack Overflow
You can try these code: this.containerEl = this.externalWindow.document.createElement('div'); this.containerEl.className = 'image'; this.
Read more >
Component Style - Chakra UI
The computed styles for each component part based on size , or variant . If none of these were passed, the defaultProps defined...
Read more >
How to create a customized data grid using griddle-react
styleConfig : takes icons and predefined classNames and those added by plugins. Also supports custom styles. pageProperties: currentPage and pageSize (number ...
Read more >
react-rating-tooltip - npm
Fully CSS customizable - Styles of Rating Counter, star-container, selected status and tooltip style,; Custom position of rating counter and ...
Read more >
Goober, A Less Than 1KB Css-in-js Alternative with A Familiar ...
To create a className, you need to call css with your style rules in a tagged ... You can use a custom css...
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