JSPM

@rebass/preset

4.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3003
  • Score
    100M100P100Q114199F
  • License MIT

Base theme preset for use with Rebass

Package Exports

  • @rebass/preset

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rebass/preset) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@rebass/preset

Base theme preset for use with Rebass

npm i @rebass/preset

Usage

For general usage with Emotion, pass the theme preset to Emotion's ThemeProvider component at the root of your application.

import React from 'react'
import { ThemeProvider } from 'emotion-theming'
import theme from '@rebass/preset'

export default props =>
  <ThemeProvider theme={theme}>
    {props.children}
  </ThemeProvider>

For use with Theme UI, import the ThemeProvider from theme-ui.

import { ThemeProvider } from 'theme-ui'

Or, if you're using gatsby-plugin-theme-ui, export the theme from src/gatsby-plugin-theme-ui/index.js.

// src/gatsby-plugin-theme-ui/index.js
import preset from '@rebass/preset'

export default {
  ...preset
}

Customizing

The base theme object can be customized by using either deepmerge or lodash.merge to deeply merge objects.

import merge from 'lodash.merge'
import preset from '@rebass/preset'

export default merge(preset, {
  colors: {
    // custom primary color
    primary: 'tomato',
  }
})

MIT License