MCPcopy
hub / github.com/system-ui/theme-ui

github.com/system-ui/theme-ui @v0.17.4 sqlite

repository ↗ · DeepWiki ↗ · release v0.17.4 ↗
341 symbols 1,054 edges 248 files 6 documented · 2%
README

Theme UI logo Theme UI logo

Theme UI

The Design Graph Framework

 

GitHub GitHub Stars npm (latest) npm (develop)

Contributors

Size Tree Shaking MIT license Join our Discord community

This project is using Cypress for end-to-end tests. This project is using Percy.io for visual regression testing.

\ Theme UI is a library for creating themeable user interfaces based on constraint-based design principles. Build custom component libraries, design systems, web applications, Gatsby themes, and more with a flexible API for best-in-class developer ergonomics.

stable docs: https://theme-ui.com \ develop (prerelease) docs: https://dev.theme-ui.com


Built for design systems, white-labels, themes, and other applications where customizing colors, typography, and layout are treated as first-class citizens and based on a standard Theme Specification, Theme UI is intended to work in a variety of applications, libraries, and other UI components. Colors, typography, and layout styles derived from customizable theme-based design scales help you build UI rooted in constraint-based design principles.

  • The next evolution of Styled System
  • From the creators of utility-based, atomic CSS methodologies
  • Theme-based styling with the sx prop
  • Compatible with virtually any UI component library
  • Works with existing Styled System components
  • Quick mobile-first responsive styles
  • Built-in support for dark modes
  • Primitive page layout components
  • Completely customizable with robust theming
  • Built with a standard Theme Specification for interoperability
  • Built with Emotion for scoped styles
  • Plugin for use in Gatsby sites and themes
  • Style MDX content with a simple, expressive API
  • Works with Typography.js themes

Getting Started

npm install theme-ui @emotion/react

If you don't need color modes or components you can install @theme-ui/core.

Any styles in your app can reference values from the global theme object. To provide the theme in context, wrap your application with the ThemeUIProvider component and pass in a custom theme object.

// basic usage
import { ThemeUIProvider } from 'theme-ui'
import theme from './theme'

export default (props) => (
  <ThemeUIProvider theme={theme}>{props.children}</ThemeUIProvider>
)

The theme object follows the System UI Theme Specification, which lets you define custom color palettes, typographic scales, fonts, and more. Read more about theming.

// example theme.js
export default {
  fonts: {
    body: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif',
    heading: '"Avenir Next", sans-serif',
    monospace: 'Menlo, monospace',
  },
  colors: {
    text: '#000',
    background: '#fff',
    primary: '#33e',
  },
}

sx prop

The sx prop works similarly to Emotion's css prop, accepting style objects to add CSS directly to an element in JSX, but includes extra theme-aware functionality. Using the sx prop for styles means that certain properties can reference values defined in your theme object. This is intended to make keeping styles consistent throughout your app the easy thing to do.

The sx prop only works in modules that have defined a custom pragma at the top of the file, which replaces the default React JSX functions. This means you can control which modules in your application opt into this feature without the need for a Babel plugin or additional configuration.

/** @jsxImportSource theme-ui */

export default (props) => (



    Hello



)

Read more about how the custom pragma works.

Responsive styles

The sx prop also supports using arrays as values to change properties responsively with a mobile-first approach. This API originated in Styled System and is intended as a terser syntax for applying responsive styles across a singular dimension.

/** @jsxImportSource theme-ui */

export default (props) => (



)

Documentation

MIT License

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Brent Jackson 🤔 💻 🎨 📖 💡 ⚠️ 👀 Piotr Monwid-Olechnowicz 💻 📖 ⚠️ 👀 💡 Dany Castillo 💻 📖 💡 ⚠️ Jordan Overbye 💻 💡 ⚠️ Lachlan Campbell 💻 💡 ⚠️ 👀 📖 💬 John Otander 💻 👀 📖 ⚠️ 🤔 David Burles 💻 👀 ⚠️ 📖 Max Stoiber 💻 👀 ⚠️ 💡
Atanas Stoyanov 💻 💬 ⚠️ 🐛 📖 Lennart 💻 🐛 📖 💡

Extension points exported contracts — how you extend this code

MDXProviderComponents (Interface)
(no doc)
packages/mdx/src/Themed.tsx
TypeScaleProps (Interface)
(no doc)
packages/style-guide/src/TypeScale.tsx
SVGProps (Interface)
(no doc)
packages/components/src/SVG.tsx
CustomProperties (Interface)
(no doc)
packages/custom-properties/src/index.ts
Element (Interface)
(no doc)
packages/core/src/index.ts
ThemeUIContextValue (Interface)
(no doc)
packages/color-modes/src/index.tsx
ThemeUIPrismProps (Interface)
(no doc)
packages/prism/src/index.tsx
ThemeUIPresetSketchy (Interface)
(no doc)
packages/preset-sketchy/src/index.ts

Core symbols most depended-on inside this repo

renderJSON
called by 86
packages/test-utils/src/index.tsx
render
called by 83
packages/prism/test/index.tsx
css
called by 55
packages/css/src/index.ts
jsx
called by 37
packages/core/src/index.ts
useColorMode
called by 33
packages/color-modes/src/index.tsx
useThemeUI
called by 30
packages/core/src/index.ts
get
called by 22
packages/css/src/index.ts
makeTheme
called by 21
packages/css/src/utils.ts

Shape

Function 247
Interface 94

Languages

TypeScript100%

Modules by API surface

packages/color/src/index.ts17 symbols
packages/typography/src/to-theme.ts16 symbols
packages/css/src/types.ts15 symbols
packages/core/src/index.ts15 symbols
packages/color-modes/test/index.tsx15 symbols
packages/docs/src/components/sidenav.tsx12 symbols
packages/color-modes/src/index.tsx12 symbols
packages/theme-ui/src/index.ts8 symbols
packages/prism/src/index.tsx8 symbols
packages/mdx/src/Themed.tsx8 symbols
packages/color-modes/src/custom-properties.ts7 symbols
scripts/publish-to-npm.mjs6 symbols

Dependencies from manifests, versioned

@auto-it/all-contributors11.2.1 · 1×
@auto-it/conventional-commits11.2.1 · 1×
@auto-it/core11.2.1 · 1×
@auto-it/first-time-contributor11.2.1 · 1×
@auto-it/magic-zero11.2.1 · 1×
@auto-it/npm11.2.1 · 1×
@auto-it/omit-commits11.2.1 · 1×
@auto-it/released11.2.1 · 1×
@babel/cli7.28.3 · 1×
@babel/helper-string-parser7.27.1 · 1×
@babel/helper-validator-identifier7.28.5 · 1×
@babel/plugin-transform-runtime7.24.3 · 1×

For agents

$ claude mcp add theme-ui \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact