index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/custom-properties/.npmignore | babel.config.js
test
coverage
| 7,700 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/custom-properties/CHANGELOG.md | # v0.12.0 (Thu Oct 28 2021)
:tada: This release contains work from a new contributor! :tada:
Thank you, William Pei ([@draekien](https://github.com/draekien)), for all your work!
#### 🐛 Bug Fix
- Merge remote-tracking branch 'upstream/develop' into fix/color-scheme-media-query-api-update [#981](https://github.com/... | 7,701 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/custom-properties/README.md | # @theme-ui/custom-properties
Generate CSS custom properties for use with Theme UI.
https://theme-ui.com
## Installation
```
npm i @theme-ui/custom-properties
```
## Usage
Transform your Theme UI compliant theme config with the library:
```js
const toCustomProperties = require('@theme-ui/custom-properties')
cons... | 7,702 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/custom-properties/package.json | {
"name": "@theme-ui/custom-properties",
"description": "Generate CSS custom properties for use with Theme UI",
"version": "0.16.2-develop.0",
"source": "src/index.ts",
"main": "dist/theme-ui-custom-properties.cjs.js",
"module": "dist/theme-ui-custom-properties.esm.js",
"author": "Alex Page <alex@alexpage... | 7,703 |
0 | petrpan-code/system-ui/theme-ui/packages/custom-properties | petrpan-code/system-ui/theme-ui/packages/custom-properties/src/index.ts | import pluralize from 'pluralize'
import { Theme } from '@theme-ui/css'
// Simplified validator based on spec https://www.w3.org/TR/CSS22/syndata.html#value-def-identifier
// Does not check for "cannot start with a digit, two hyphens, or a hyphen followed by a digit"
const keyValidator = /^[A-z0-9][\w-]*$/
interface ... | 7,704 |
0 | petrpan-code/system-ui/theme-ui/packages/custom-properties | petrpan-code/system-ui/theme-ui/packages/custom-properties/test/test.mjs | // @ts-check
import themeUICustomProperties from '..'
import mockConsole from 'jest-mock-console'
const toCustomProperties = /** @type {{ default: import('..').default }} */ (
/** @type {any} */ (themeUICustomProperties)
).default
const theme = {
colors: {
text: '#000',
background: '#fff',
primary: '#... | 7,705 |
0 | petrpan-code/system-ui/theme-ui/packages/custom-properties/test | petrpan-code/system-ui/theme-ui/packages/custom-properties/test/__snapshots__/test.mjs.snap | // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`transforms a theme config to CSS custom properties 1`] = `
{
"--color-accent": "#609",
"--color-background": "#fff",
"--color-dark-background-surface": "#fff",
"--color-dark-foreground-text": "#000",
"--color-muted": "#f6f6f6",
"--color-primary": "#07c",
... | 7,706 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/.babelrc | {
"presets": [
[
"babel-preset-gatsby",
{
"reactRuntime": "automatic",
"reactImportSource": "@theme-ui/core"
}
]
]
}
| 7,707 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/.env.development | DEBUG="gatsby:query-watcher"
| 7,708 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/.eslintignore | *.esm.js
| 7,709 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/.eslintrc.js | module.exports = {
extends: '../../.eslintrc.js',
}
| 7,710 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/declarations.d.ts | declare module '!!raw-loader!*' {
const content: string
export default content
}
declare module '*.mdx' {
let MDXComponent: (props: any) => JSX.Element
export default MDXComponent
}
declare module '*.md' {
let MDXComponent: (props: any) => JSX.Element
export default MDXComponent
}
| 7,711 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/gatsby-browser.js | // @ts-check
// @see https://www.gatsbyjs.com/docs/reference/config-files/gatsby-browser/
import * as React from 'react'
import { WrapPageElement } from './src'
export const wrapPageElement = (props) => (
<React.StrictMode>
<WrapPageElement {...props} />
</React.StrictMode>
)
| 7,712 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/gatsby-config.js | const remarkGfm = require('remark-gfm-1')
const remarkSlug = require('remark-slug')
const { rehypeMetaAsAttributes } = require('./src/rehype-meta-props.cjs')
module.exports = {
siteMetadata: {
siteUrl: 'https://theme-ui.com',
},
plugins: [
'gatsby-plugin-pnpm',
'gatsby-plugin-theme-ui',
'gatsby-p... | 7,713 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/gatsby-node.js | const presets = require('@theme-ui/presets')
const fs = require('fs')
const path = require('path')
const { rehypeMetaAsAttributes } = require('./src/rehype-meta-props.cjs')
const Preset = require.resolve('./src/templates/preset')
const LOG_CONFIG = !!process.env.LOG_CONFIG
module.exports.createPages = ({ actions }) ... | 7,714 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/gatsby-ssr.js | // @ts-check
// @see https://www.gatsbyjs.com/docs/reference/config-files/gatsby-ssr/
import * as React from 'react'
import { WrapPageElement, setDocSearchComponents } from './src'
export const wrapPageElement = (props) => (
<React.StrictMode>
<WrapPageElement {...props} />
</React.StrictMode>
)
export cons... | 7,715 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/package.json | {
"private": true,
"name": "docs",
"version": "0.16.2-develop.0",
"main": "dist/docs.cjs.js",
"author": "Brent Jackson <jxnblk@gmail.com>",
"license": "MIT",
"repository": "system-ui/theme-ui",
"scripts": {
"start": "gatsby develop",
"dev": "gatsby develop",
"build": "gatsby build",
"ser... | 7,716 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/docs/tsconfig.json | {
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@theme-ui/core",
"resolveJsonModule": true,
"allowJs": true,
"checkJs": true,
"noEmit": true
},
"exclude": [".cache", "node_modules", "public"],
"include": ["**/*.js", "src/**/*", "./declarations.d.ts"]
}
| 7,717 |
0 | petrpan-code/system-ui/theme-ui/packages/docs | petrpan-code/system-ui/theme-ui/packages/docs/scripts/svg-logo.js | require('@babel/register')({
presets: ['@babel/preset-env', '@babel/preset-react'],
})
const fs = require('fs')
const path = require('path')
const React = require('react')
const { renderToStaticMarkup } = require('react-dom/server')
const Logo = require('../src/components/logo').default
const OGImage = require('../s... | 7,718 |
0 | petrpan-code/system-ui/theme-ui/packages/docs | petrpan-code/system-ui/theme-ui/packages/docs/src/index.js | // @ts-check
import Layout from './components/layout'
export { default as Banner } from './components/banner'
export { default as Tiles } from './components/tiles'
export { default as Cards } from './components/cards'
export { default as Note } from './components/note'
/**
* @param {import("gatsby").WrapPageElement... | 7,719 |
0 | petrpan-code/system-ui/theme-ui/packages/docs | petrpan-code/system-ui/theme-ui/packages/docs/src/rehype-meta-props.cjs | const visit = require('unist-util-visit-2')
const META_ATTR_REGEX = /\b([-\w]+)(?:=(?:"([^"]*)"|'([^']*)'|([^"'\s]+)))?/g
/** @type {import('unified').Plugin<Array<void>, import('hast').Root>} */
function rehypeMetaAsAttributes() {
return (tree) => {
visit(tree, 'element', (node) => {
if (node.tagName ===... | 7,720 |
0 | petrpan-code/system-ui/theme-ui/packages/docs | petrpan-code/system-ui/theme-ui/packages/docs/src/sidebar.ts | export type SidebarLink = readonly [
text: string,
href: string,
children?: SidebarLink[]
]
export type Sidebar = SidebarLink[]
export const sidebar: Sidebar = [
[
'Getting Started',
'/getting-started',
[['Getting Started with Gatsby', '/getting-started/gatsby']],
],
['Theming', '/theming'],
[... | 7,721 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/banner.js | import { ThemeUIProvider, Container } from 'theme-ui'
export default (props) => (
<ThemeUIProvider
theme={{
styles: {
p: {
maxWidth: '40em',
my: 4,
},
h1: {
fontSize: [3, 3, 4],
letterSpacing: '0',
my: 4,
},
a: {
... | 7,722 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/button.js | /**
* @param {React.ComponentPropsWithoutRef<"button">} props
*/
export default function DocsButton(props) {
return (
<button
{...props}
sx={{
appearance: 'none',
fontFamily: 'inherit',
fontSize: 1,
fontWeight: 'bold',
m: 0,
px: 2,
py: 2,
... | 7,723 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/cards.js | import Tiles from './tiles'
export default (props) => (
<Tiles
{...props}
sx={{
my: 4,
p: {
m: 0,
},
a: {
variant: 'text.heading',
display: 'block',
fontWeight: 'bold',
fontSize: 3,
color: 'inherit',
textDecoration: 'none',
... | 7,724 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/code.tsx | // @ts-check
import { Text } from 'theme-ui'
import { Themed } from '@theme-ui/mdx'
import Prism, { ThemeUIPrismProps } from '@theme-ui/prism'
import { LiveProvider, LiveEditor, LivePreview, LiveError } from 'react-live'
import * as themeUI from 'theme-ui'
import { ComponentPropsWithoutRef } from 'react'
import { Prism... | 7,725 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/color-keys.mdx | | Key | Description |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
| `text` | Body foreground color ... | 7,726 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/components.mdx | {/* original from https://github.com/beerose/theme-ui-sketchy/blob/master/src/components/components.mdx */}
import { useTheme } from '@emotion/react'
import {
Message,
NavLink,
Divider,
Container,
Box,
Button,
Card,
Text,
Paragraph,
Image,
Slider,
Label,
Flex,
Checkbox,
Select,
Textarea... | 7,727 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/debug-theme.js | import { useThemeUI } from 'theme-ui'
export default () => {
const theme = useThemeUI()
return <pre children={JSON.stringify(theme, null, 2)} />
}
| 7,728 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/edit-link.js | import { Location } from '@reach/router'
import { jsx } from 'theme-ui'
const getHREF = (base, location) => {
if (location.pathname === '/') return
const sanitizedLocationPathname = location.pathname.replace(/\/+$/, '')
const basePagesHref = `${base}/pages` + sanitizedLocationPathname
if (location.pathname =... | 7,729 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/google-fonts.js | // for development only
import { useEffect, useContext } from 'react'
import { useThemeUI } from 'theme-ui'
const parseTypographyGoogleFonts = (typography) => {
const { googleFonts } = typography.options
if (!googleFonts) return null
const families = googleFonts
.map(
({ name, styles }) => `${name.spli... | 7,730 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/graph.js | import { get, useThemeUI } from 'theme-ui'
import { useState, useEffect } from 'react'
import merge from 'deepmerge'
import Logo from './logo'
const colors = ['background', 'primary', 'secondary', 'accent']
const initialState = {
0: {
0: 0,
1: 1,
2: 1,
3: 2,
4: 2,
5: 0,
6: 0,
7: 1,
... | 7,731 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/head.js | import React from 'react'
import { Helmet } from 'react-helmet'
import { useThemeUI } from 'theme-ui'
import pkg from 'theme-ui/package.json'
export default (props) => {
const title = [
props.title,
props.pageContext.frontmatter ? props.pageContext.frontmatter.title : false,
props._frontmatter ? props._f... | 7,732 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/layout.js | import { Fragment } from 'react'
import { useColorMode } from 'theme-ui'
import { useState, useRef, useEffect, Suspense } from 'react'
import { Flex, Box } from '@theme-ui/components'
import { Link } from 'gatsby'
import { AccordionNav } from './sidenav'
import SkipLink from './skip-link'
import Pagination from './pag... | 7,733 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/logo.js | import React from 'react'
const css = {
__html: `
<![CDATA[
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 900;
font-display: swap;
src: url(https://fonts.gstatic.com/s/inter/v1/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuBWYAZ9hiA.woff2) format('woff2');
unicode-range: U+0000-00FF,... | 7,734 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/lorem.mdx | **Demo Content**
_From https://jxnblk.com/blog/interoperability_
# Interoperability
Back in early 2013, I was working at a small startup in San Francisco called Stitch Fix, alongside Adam Morse and a handful of others.
We were designing and building out early versions of their marketing pages and some internal tools... | 7,735 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/menu-button.js | const Burger = ({ size = '1em' }) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
fill="currentcolor"
viewBox="0 0 24 24"
sx={{
display: 'block',
margin: 0,
}}
>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />
</svg>
)
export default ... | 7,736 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/nav-link.js | /* eslint jsx-a11y/anchor-has-content: 0 */
import { Link } from 'gatsby'
import isAbsoluteURL from 'is-absolute-url'
const styles = {
variant: 'links.nav',
}
export default ({ href, ...props }) => {
const isExternal = isAbsoluteURL(href || '')
if (isExternal) {
return <a {...props} href={href} sx={styles} ... | 7,737 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/note.js | export default (props) => (
<aside
{...props}
sx={{
// fontWeight: 'bold',
padding: 3,
bg: 'highlight',
borderRadius: 4,
borderLeft: (t) => `8px solid ${t.colors.primary}`,
p: {
m: 0,
},
}}
/>
)
| 7,738 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/og-image.js | import React from 'react'
import Logo from './logo'
export default ({ width = 1280, height = 720 }) => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 1280 720"
width={width}
height={height}
style={{
display: 'block',
color: 'white',
width,
height,
}}>
<rect... | 7,739 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/pagination.tsx | import { Location } from '@reach/router'
import { Pagination } from './sidenav'
import { sidebar } from '../sidebar'
export default function DocsPagination() {
return (
<Location>
{({ location }) => (
<Pagination links={sidebar} pathname={location.pathname} />
)}
</Location>
)
}
| 7,740 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/preset.js | import { Helmet } from 'react-helmet'
import { Themed } from '@theme-ui/mdx'
import { ThemeContext } from '@emotion/react'
import * as presets from '@theme-ui/presets'
import {
TypeScale,
TypeStyle,
HeadingStyle,
ColorPalette,
FontFamily,
} from '@theme-ui/style-guide'
import Components from './components.mdx... | 7,741 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/presets-demo.js | import { ThemeUIProvider, Select } from 'theme-ui'
import { Themed } from '@theme-ui/mdx'
import { useState } from 'react'
import { Helmet } from 'react-helmet'
import * as presets from '@theme-ui/presets'
import {
TypeScale,
TypeStyle,
HeadingStyle,
ColorPalette,
FontFamily,
} from '@theme-ui/style-guide'
im... | 7,742 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/readme-badges.js | // Straight-up copied from README.md
// We may extract it from that Markdown file in a fancy way some day. Maybe...
export default function ReadmeBadges() {
return (
<div
data-testid="readme-badges"
sx={{
display: 'flex',
flexWrap: 'wrap',
gap: '4px',
'> a': { height: '... | 7,743 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/search-input.tsx | import { Input } from '@theme-ui/components'
import { ThemeUICSSObject } from '@theme-ui/css'
import { useEffect } from 'react'
/**
* @see https://docsearch.algolia.com/docs/styling/
*/
const algoliaStyles: ThemeUICSSObject = {
'.algolia-autocomplete': {
color: 'text',
'.ds-dropdown-menu': {
backgrou... | 7,744 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/sidenav.tsx | import { ThemeUIProvider, Theme, ThemeStyles, Global } from 'theme-ui'
import { MDXProvider } from '@mdx-js/react'
import { useLocation } from '@reach/router'
import {
useState,
EventHandler,
MouseEvent,
forwardRef,
ReactNode,
} from 'react'
import * as React from 'react'
import merge from 'deepmerge'
import... | 7,745 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/skip-link.js | export default (props) => (
<a
children="Skip to content"
{...props}
href="#content"
sx={{
clip: 'rect(0 0 0 0)',
height: 1,
width: 1,
m: -1,
p: 0,
overflow: 'hidden',
position: 'absolute',
top: -9999,
':focus': {
p: 3,
position: 'f... | 7,746 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/theme-scales.js | import { scales, multiples } from '@theme-ui/css'
import { Themed } from '@theme-ui/mdx'
const camelDash = (string) =>
string.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`)
const alphabeticSort = (a, b) =>
a.localeCompare(b, undefined, {
sensitivity: 'base',
})
export default (props) => {
const exc... | 7,747 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/tiles.js | import { ThemeUIProvider } from 'theme-ui'
export default ({ columns = 3, width, ...props }) => {
const gridTemplateColumns = width
? `repeat(auto-fit, minmax(${width}px, 1fr))`
: ['auto', `repeat(${columns}, 1fr)`]
return (
<ThemeUIProvider
theme={{
styles: {
ol: {
... | 7,748 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/typography-layout.js | import { ThemeUIProvider, Flex } from 'theme-ui'
import { Themed } from '@theme-ui/mdx'
import { useState } from 'react'
import { toTheme } from '@theme-ui/typography'
import GoogleFonts from './google-fonts'
import Button from './button'
import themes from './typography-themes'
import typographyThemes from './typograp... | 7,749 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/components/typography-themes.js | import alton from 'typography-theme-alton'
import bootstrap from 'typography-theme-bootstrap'
import deYoung from 'typography-theme-de-young'
import doelger from 'typography-theme-doelger'
import elkGlen from 'typography-theme-elk-glen'
import fairyGates from 'typography-theme-fairy-gates'
import funston from 'typograp... | 7,750 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/components | petrpan-code/system-ui/theme-ui/packages/docs/src/components/intro-code-samples/index.js | // @ts-check
import React from 'react'
import Snippet from '@theme-ui/prism'
import themeCreationRaw from '!!raw-loader!./snippets/theme.tsx'
import basicUsageRaw from '!!raw-loader!./snippets/basic-usage.tsx'
const IntroCodeSamples = {
ThemeCreation() {
return <Snippet className="language-tsx" children={themeC... | 7,751 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/components/intro-code-samples | petrpan-code/system-ui/theme-ui/packages/docs/src/components/intro-code-samples/snippets/basic-usage.tsx | /** @jsxImportSource theme-ui */
import { ThemeUIProvider } from 'theme-ui'
import { theme } from './theme'
export const App = () => (
<ThemeUIProvider theme={theme}>
<h1
sx={{
color: 'primary',
fontFamily: 'heading',
}}
>
Hello
</h1>
</ThemeUIProvider>
)
| 7,752 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/components/intro-code-samples | petrpan-code/system-ui/theme-ui/packages/docs/src/components/intro-code-samples/snippets/theme.tsx | import type { Theme } from 'theme-ui'
export const theme: Theme = {
fonts: {
body: 'system-ui, sans-serif',
heading: '"Avenir Next", sans-serif',
monospace: 'Menlo, monospace',
},
colors: {
text: '#000',
background: '#fff',
primary: '#33e',
},
}
| 7,753 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/gatsby-plugin-theme-ui/components.js | import CodeBlock from '../components/code'
import Note from '../components/note'
const heading = (Tag) => (props) =>
!!props.id ? (
<Tag {...props}>
<a
href={`#${props.id}`}
sx={{
color: 'inherit',
textDecoration: 'none',
':hover': {
textDecoration:... | 7,754 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/gatsby-plugin-theme-ui/index.js | // @ts-check
import prism from '@theme-ui/prism/presets/theme-ui'
/**
* @type {import("theme-ui").ThemeUIStyleObject}
*/
const tableCellStyle = {
textAlign: 'left',
py: '4px',
pr: '4px',
pl: 0,
borderColor: 'muted',
borderBottomStyle: 'solid',
}
/**
* @type {import("theme-ui").Theme & { prism: typeof p... | 7,755 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/gatsby-theme-code-recipes/recipe.js | import { Link } from 'gatsby'
export default function RecipeLink(props) {
return (
<div>
<div
sx={{
fontWeight: 'bold',
mb: 3,
}}
>
<Link sx={(t) => t.styles.a} to="/recipes">
Recipes
</Link>
{' / '}
<span>{props.name}</spa... | 7,756 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/404.mdx | # 404
Page not found
| 7,757 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/api.mdx | ---
title: API
---
# API
## `theme-ui`
The core `theme-ui` package exports the following modules.
### `/jsx-runtime`
While not being available in the `theme-ui` package directly, there are two
separate entry points for React create element functions intended to be used in
the
[automatic JSX runtime](https://reactj... | 7,758 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/color-modes.mdx | ---
title: Color Modes
---
# Color Modes
Color modes can be used to create a user-configurable _dark mode_ or any number
of other color modes.
## Defining colors
In the `theme.colors` object, add a nested `modes` object that will contain keys
for optional color modes.
```js
// example theme colors
{
config: {
... | 7,759 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/demo.mdx | ---
title: Demo
---
import PresetsDemo from '../components/presets-demo'
# Demo
<PresetsDemo />
| 7,760 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/design-graph.mdx | ---
title: Design Graph
---
# Design Graph
The core organizing principle for styles in Theme UI is based
on a conceptual model called the _Design Graph_.
The Design Graph is composed of the following nodes:
- **Scales** are limited collections of raw values that map to specific style properties.
For example, valu... | 7,761 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/hooks.mdx | ---
title: Hooks
---
# Hooks
Theme UI includes hooks for changing the color mode state and for using the Theme UI context directly.
<Note>
To learn more about how React Hooks work, please see the [official React docs](https://reactjs.org/docs/hooks-intro.html).
</Note>
## `useThemeUI`
To access the `context` obj... | 7,762 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/index.mdx | import { Container, Box, Button } from 'theme-ui'
import { Banner, Tiles } from '..'
import Graph from '../components/graph'
import ReadmeBadges from '../components/readme-badges'
import IntroCodeSamples from '../components/intro-code-samples'
import Testimonials from './testimonials'
<Banner>
<Graph />
# Theme UI... | 7,763 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/layout.mdx | ---
title: Layout Components
---
# Layout Components
<Note>
Layout components have been deprecated. See [components](/components) instead.
</Note>
| 7,764 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/logos.mdx | ---
title: Logos
---
import Logo from '../components/logo'
# Theme UI Logos
## SVG
<Logo />
## PNG


| 7,765 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/migrating.mdx | ---
title: 'Migrating'
---
import Migrating from '../../../../MIGRATING.md'
<Migrating />
| 7,766 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/readme.mdx | ---
title: 'Readme'
---
import Readme from 'theme-ui/README.md'
<Readme />
| 7,767 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/resources.mdx | ---
name: 'Resources'
---
# Resources
Tools, themes, extensions and examples built by the Theme UI community.
## Custom themes
- [**@tabetalt/kit**](https://github.com/tabetalt/kit):
Used in Tabetalt’s e-commerce platform.
- [**@hackclub/theme**](https://theme.hackclub.com):
Used on [Hack Club’s](https://hackcl... | 7,768 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/static-css.mdx | ---
title: Static CSS
---
# Static CSS
Certain projects have constraints that require using static CSS rather
than CSS-in-JS. Theme UI contains (experimental) libraries to transform
a theme config to the proper format for other CSS libraries.
This allows you to use the Theme UI implementation in React-based projects... | 7,769 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/styled.mdx | ---
title: Styled
---
# Styled
As of Theme UI 0.6, `Styled` components dict was renamed to `Themed` to avoid
confusion with `styled` components constructor function from `@emotion/styled`.
As of Theme UI 0.15, `Themed` components have moved to the optional
`@theme-ui/mdx` package.
[Go to the docs for Themed](/mdx/t... | 7,770 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/sx-prop.mdx | ---
title: 'The `sx` Prop'
---
import { Note } from '..'
# The `sx` Prop
The `sx` prop lets you style elements inline, using values from your theme. To
use the `sx` prop, add the custom `/** @jsxImportSource theme-ui */` pragma
comment to the top of your module or configure
[automatic JSX runtime](https://reactjs.or... | 7,771 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/testimonials.mdx | import Tiles from '../components/tiles'
<Tiles
sx={{
py: 6,
p: {
m: 0,
},
blockquote: {
m: 0,
p: 0,
fontWeight: 'bold',
},
a: {
color: 'inherit',
textDecoration: 'none',
':hover': {
color: 'primary',
}
}
}}>
- > “Looking into Them... | 7,772 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/theme-spec.mdx | ---
title: Theme Spec
---
import ThemeScales from '../components/theme-scales'
import ColorKeys from '../components/color-keys'
# Theme Specification
Theme UI is based on a theme specification, which can be used in other libraries and applications for increased interoperability.
This specification is also intended t... | 7,773 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/theming.mdx | ---
title: Theming
---
import ColorKeys from '../components/color-keys'
# Theming
Theming with Theme UI is based on a [Theme Specification][] including a `theme.styles` object for styling MDX elements and other components.
By adhering to a standard Theme Specification, Theme UI is designed to be interoperable with a... | 7,774 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/alert.mdx | ---
title: Alert
---
# Alert
Component for displaying messages, notifications, or other application state.
```js
import { Alert } from 'theme-ui'
```
```jsx live=true
<Alert>
Beep boop, this is an alert!
<Close ml="auto" mr={-2} />
</Alert>
```
```jsx live=true
<Alert variant='secondary' mb={2}>Secondary</Aler... | 7,775 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/aspect-image.mdx | ---
title: AspectImage
---
# AspectImage
Image component constrained by as aspect ratio.
```js
import { AspectImage } from 'theme-ui'
```
```jsx live=true
<AspectImage ratio={4 / 3} src={images.flatiron} />
```
| 7,776 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/aspect-ratio.mdx | ---
title: AspectRatio
---
# AspectRatio
Component for maintaining a fluid-width aspect ratio
```js
import { AspectRatio } from 'theme-ui'
```
```jsx live=true
<AspectRatio
ratio={16 / 9}
sx={{
p: 4,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: 'background',
bg... | 7,777 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/avatar.mdx | ---
title: Avatar
---
# Avatar
```js
import { Avatar } from 'theme-ui'
```
```jsx live=true
<Avatar src={images.logo} sx={{ backgroundColor: 'white' }} />
```
## Variants
Avatar style variants can be defined in the `theme.images` object and uses `theme.images.avatar` by default.
```js
// example theme variants
{
... | 7,778 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/badge.mdx | ---
title: Badge
---
# Badge
```js
import { Badge } from 'theme-ui'
```
```jsx live=true
<Badge>Badge</Badge>
```
```jsx live=true
<Heading>
Components
<Badge variant="accent">New</Badge>
<Badge variant="outline" ml={1}>
Cool
</Badge>
</Heading>
```
```jsx live=true
<Avatar src={images.logo} sx={{ back... | 7,779 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/box.mdx | ---
title: Box
---
# Box
Use the `Box` component as a layout primitive to add margin, padding, and colors
to content.
```js
import { Box } from 'theme-ui'
```
```jsx live=true
<Box p={4} color="background" bg="primary">
Beep
</Box>
```
| 7,780 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/button.mdx | ---
title: Button
---
# Button
Primitive button component with variants
```js
import { Button } from 'theme-ui'
```
```jsx live=true
<Button mr={2}>Beep</Button>
<Button variant='secondary'>Boop</Button>
<Button ml={2} hidden>Hidden</Button>
```
## Variants
Button variants can be defined in the `theme.buttons` ob... | 7,781 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/card.mdx | ---
title: Card
---
# Card
```js
import { Card } from 'theme-ui'
```
```jsx live=true
<Card
sx={{
maxWidth: 256,
}}
>
<Image src={images.nyc} />
<Text>Card</Text>
</Card>
```
## Variants
Card style variants can be defined in the `theme.cards` object. By default the
Card component uses the `theme.cards.... | 7,782 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/checkbox.mdx | ---
title: Checkbox
---
# Checkbox
Form checkbox input component
```js
import { Checkbox } from 'theme-ui'
```
```js live=true
<Label>
<Checkbox defaultChecked={true} />
</Label>
```
## Variants
Checkbox variants can be defined in `theme.forms` and the component uses the `theme.forms.checkbox` variant by defaul... | 7,783 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/close.mdx | ---
title: Close
---
# Close
Button with close (×) icon.
```js
import { Close } from 'theme-ui'
```
```jsx live=true
<Close />
```
The `Close` component renders as a `<button>` element by default. Pass any button attributes as props to the component.
## Variants
Close component variants can be defined in the `th... | 7,784 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/container.mdx | ---
title: Container
---
# Container
Centered, max-width layout component
```js
import { Container } from 'theme-ui'
```
```jsx live=true
<Container p={4} bg="muted">
Centered container
</Container>
```
The Container component's max-width can be defined in `theme.sizes.container`.
## Variants
Container variant... | 7,785 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/divider.mdx | ---
title: Divider
---
# Divider
```js
import { Divider } from 'theme-ui'
```
```jsx live=true
<Divider />
```
## Variants
The Divider component reuses styles from `theme.styles.hr` as its default variant.
| 7,786 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/donut.mdx | ---
title: Donut
---
# Donut
Single value SVG donut chart
```js
import { Donut } from 'theme-ui'
```
```jsx live=true
<Donut value={1 / 2} />
```
## Props
| Name | Type | Description |
| ------------- | ------ | ------------------------------ |
| `value` | Number | Value to dis... | 7,787 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/embed.mdx | ---
title: Embed
---
# Embed
Responsive iframe for video embeds.
```js
import { Embed } from 'theme-ui'
```
```js live=true
<Embed src="https://www.youtube.com/embed/GNCd_ERZvZM" />
```
Props besides [`sx`](/sx-prop) will be passed to the `iframe` itself, since
using a [`title` prop](https://accessibility.18f.gov/... | 7,788 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/field.mdx | ---
title: Field
---
# Field
Wrapper around primitive form control components
```js
import { Field } from 'theme-ui'
```
```jsx live=true
<Field label="Email" name="email" defaultValue="" />
```
## Props
| Name | Type | Description |
| ------- | --------- | ------------... | 7,789 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/flex.mdx | ---
title: Flex
---
# Flex
Use the `Flex` component to create flexbox layouts.
```js
import { Flex } from 'theme-ui'
```
```jsx live=true
<Flex>
<Box p={2} bg="primary" color="white" sx={{ flex: '1 1 auto' }}>
Flex
</Box>
<Box p={2} bg="muted">
Box
</Box>
</Flex>
```
<Note>
The `Flex` component is... | 7,790 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/forms.mdx | ---
title: Forms
---
import { Note } from '../..'
# Forms
Several primitive components are included for building accessible forms.
```js
import {
Label,
Input,
Select,
Textarea,
Radio,
Checkbox,
Slider,
} from 'theme-ui'
```
```jsx live=true
<Box as="form" onSubmit={(e) => e.preventDefault()}>
<Lab... | 7,791 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/grid.mdx | ---
title: Grid
---
# Grid
CSS grid layout component to arrange direct child elements in a tiled grid layout.
```sh
import { Grid } from 'theme-ui'
```
```jsx live=true
<Grid width={[128, null, 192]}>
<Box bg="primary">Box</Box>
<Box bg="muted">Box</Box>
<Box bg="primary">Box</Box>
<Box bg="muted">Box</Box>... | 7,792 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/heading.mdx | ---
title: Heading
---
# Heading
Primitive heading component, defaults to `<h2>`.
```js
import { Heading } from 'theme-ui'
```
```jsx live=true
<Heading>Hello</Heading>
<Heading as='h3'>Subhead</Heading>
```
Use the `as` prop to set the correct HTML element independent from styling.
## Variants
Text style varian... | 7,793 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/icon-button.mdx | ---
title: IconButton
---
# IconButton
Transparent button for SVG icons
```js
import { IconButton } from 'theme-ui'
```
```jsx live=true
<IconButton aria-label="Toggle dark mode">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="24"
height="24"
fill="currentcolor">
<circl... | 7,794 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/image.mdx | ---
title: Image
---
# Image
```js
import { Image } from 'theme-ui'
```
```jsx live=true
<Image src={images.flatiron} />
```
```jsx live=true
<Image src={images.logo} variant="avatar" />
```
## Variants
Image style variants can be defined in the `theme.images` object.
```js
// example theme variants
{
images: ... | 7,795 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/index.mdx | ---
title: Components
---
import { Note } from '../..'
# Components
A number of built-in UI components are available for layouts, grids, buttons, form elements, and more.
Components can be used as an alternative to the [JSX pragma](/jsx-pragma) for using Theme UI features,
or in parallel to provide specific UI compo... | 7,796 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/input.mdx | ---
title: Input
---
# Input
Form input component
```js
import { Input } from 'theme-ui'
```
```js live=true
<Input defaultValue="Hello" />
```
## Variants
Input variants can be defined in `theme.forms` and the component uses the
`theme.forms.input` variant by default.
## Autocomplete styles
Background color of... | 7,797 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/label.mdx | ---
title: Label
---
# Label
Form label component
```js
import { Label } from 'theme-ui'
```
```js live=true
<Label>Form Label</Label>
```
## Variants
Label variants can be defined in `theme.forms` and the component uses the `theme.forms.label` variant by default.
| 7,798 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/link.mdx | ---
title: Link
---
# Link
```js
import { Link } from 'theme-ui'
```
```jsx live=true
<Link href="#!">Hello</Link>
```
## Variants
Link variants can be defined in the `theme.links` object.
By default the Link component will use styles defined in `theme.styles.a`.
```js
// example theme variants
{
links: {
b... | 7,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.