JSPM

@theme-ui/css

0.14.0--canary.2168.121753348ca31f98a11ec969e6030d001a4faeed.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 140511
  • Score
    100M100P100Q202141F
  • License MIT

Package Exports

  • @theme-ui/css
  • @theme-ui/css/dist/theme-ui-css.cjs.js
  • @theme-ui/css/dist/theme-ui-css.esm.js
  • @theme-ui/css/utils
  • @theme-ui/css/utils/dist/theme-ui-css-utils.cjs.js
  • @theme-ui/css/utils/dist/theme-ui-css-utils.esm.js

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 (@theme-ui/css) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@theme-ui/css

Minified Size on Bundlephobia

@theme-ui/css contains the framework-agnostic core logic of Theme UI. It lets you write style objects with responsive, theme-aware ergonomic shortcuts.

npm i @theme-ui/css @emotion/react

Usage

import { css as transformStyleObject } from '@theme-ui/css'
import { css as createClassName } from '@emotion/css'

const root = document.getElementById('root')

/** @type {import("@theme-ui/css").Theme} */
const theme = {
  colors: {
    text: '#222',
  },
  fonts: {
    mono: 'monospace',
  },
  space: {
    sm: '1rem',
    md: '2rem',
  },
}

const styles = transformStyleObject({
  padding: ['sm', 'md'],
  border: ({ colors }) => `2px solid ${colors.text}`,
  h1: {
    fontFamily: 'mono',
    color: 'text',
  },
})(theme)

root.classList.add(createClassName(styles))
root.innerHTML = `
<h1>You can use <code>@theme-ui/css</code> in Vanilla JS!</h1>
`

See the snippet above on CodeSandbox