Socket
Socket
Sign inDemoInstall

@emotion/provider

Package Overview
Dependencies
14
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @emotion/provider

A provider component to provide options to emotion and allow theming


Version published
Maintainers
2
Install size
214 kB
Created

Readme

Source

@emotion/provider

A React component to provide a theme to child components

Install

yarn add @emotion/provider

Usage

/** @jsx jsx */
import { jsx } from '@emotion/jsx'
import styled from '@emotion/styled'
import * as React from 'react'
import ThemeProvider from '@emotion/provider'

let SomeParagraph = styled.p`
  color: ${props => props.theme.primaryColor};
`

class SomeComponent extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      theme: {
        primaryColor: 'hotpink'
      }
    }
  }
  render() {
    return (
      <ThemeProvider theme={this.state.theme}>
        <h1 css={theme => ({ color: theme.primaryColor })}>some heading</h1>
        <SomeParagraph>some text</SomeParagraph>
      </ThemeProvider>
    )
  }
}

FAQs

Last updated on 20 Sep 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc