Skip to content

Instantly share code, notes, and snippets.

@mfix22
Created May 6, 2019 18:58
Show Gist options
  • Save mfix22/2e5f8227867f8b3e7b638b85f4ef55f0 to your computer and use it in GitHub Desktop.
Save mfix22/2e5f8227867f8b3e7b638b85f4ef55f0 to your computer and use it in GitHub Desktop.
Create a global custom styles component
import { ThemeProvider, createGlobalStyle, css } from 'styled-components'
export const CustomStyles = createGlobalStyle`${props =>
css`
${props.children};
`}`;
// Usage
<ThemeProvider theme={theme}>
{props.children}
<CustomStyles>
{/* user's custom styled go here */}
{userTheme.customStyles}
</CustomStyles>
</ThemeProvider>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment