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/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/menu-button.mdx | ---
title: MenuButton
---
# MenuButton
```js
import { MenuButton } from 'theme-ui'
```
```jsx live=true
<MenuButton aria-label="Toggle Menu" />
```
## Variants
MenuButton variants can be defined in the `theme.buttons` object.
By default the MenuButton component will use styles defined in `theme.buttons.menu`.
| 7,800 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/message.mdx | ---
title: Message
---
# Message
Styled Box component for callouts and inline messages
```js
import { Message } from 'theme-ui'
```
```jsx live=true
<Message>This is just a message for someone to read</Message>
```
## Variants
Message variants can be defined in the `theme.messages` object.
| 7,801 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/nav-link.mdx | ---
title: NavLink
---
# NavLink
Link component for use in navigation
```js
import { NavLink } from 'theme-ui'
```
```jsx live=true
<Flex as="nav">
<NavLink href="#!" p={2}>
Home
</NavLink>
<NavLink href="#!" p={2}>
Blog
</NavLink>
<NavLink href="#!" p={2}>
About
</NavLink>
</Flex>
```
## V... | 7,802 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/paragraph.mdx | ---
title: Paragraph
---
# Paragraph
Primitive typographic component meant to display text blocks, defaults to `<p>`.
```js
import { Paragraph } from 'theme-ui'
```
```jsx live=true
<Paragraph>Hello World!</Paragraph>
<Paragraph variant="block">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nunc ... | 7,803 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/progress.mdx | ---
title: Progress
---
# Progress
A horizontal bar to represent the completion progress of a task
```js
import { Progress } from 'theme-ui'
```
```jsx live=true
<Progress max={1} value={1 / 2}>
50%
</Progress>
```
## Variants
Progress variants can be defined anywhere in the `theme` object.
```js
// example th... | 7,804 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/radio.mdx | ---
title: Radio
---
# Radio
Form radio input component
```js
import { Radio } from 'theme-ui'
```
```js live=true
<Label>
<Radio
name='dark-mode'
value='true'
defaultChecked={true}
/>
Dark Mode
</Label>
<Label>
<Radio
name='dark-mode'
value='false'
/>
Light Mode
</Label>
```
## Var... | 7,805 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/select.mdx | ---
title: Select
---
# Select
Form select component
```js
import { Select, Box } from 'theme-ui'
```
```js live=true
<Select defaultValue="Hello">
<option>Hello</option>
<option>Hi</option>
<option>Beep</option>
<option>Boop</option>
</Select>
```
## Variants
Select variants can be defined in `theme.form... | 7,806 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/slider.mdx | ---
title: Slider
---
# Slider
Range input element
```js
import { Slider } from 'theme-ui'
```
```jsx live=true
<Slider defaultValue={25} />
```
## Variants
Slider variants can be defined in the `theme.forms` object.
The Slider component uses `theme.forms.slider` as its default variant style.
```js
// example th... | 7,807 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/spinner.mdx | ---
title: Spinner
---
# Spinner
Spinning SVG loading indicator
```js
import { Spinner } from 'theme-ui'
```
```jsx live=true
<Spinner />
```
## Props
| Name | Type | Description |
| ------------- | ------ | ------------------------------------------------ |
| `titl... | 7,808 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/switch.mdx | ---
title: Switch
---
# Switch
Form switch input component
```js
import { Switch } from 'theme-ui'
```
```jsx live=true
<Switch label="Enable email alerts?" />
```
## Input state style `&:checked`
The Switch component renders several elements, among other things an
`<input type="checkbox" />`, the state of which ... | 7,809 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/text.mdx | ---
title: Text
---
# Text
Primitive typographic component.
```js
import { Text } from 'theme-ui'
```
```jsx live=true
<Text variant='caps'>Hello</Text>
<Text
sx={{
fontSize: 2,
fontWeight: 'bold',
display: 'block'
}}
>
How's it going?
</Text>
```
## Variants
Text style variants can be defined i... | 7,810 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/textarea.mdx | ---
title: Textarea
---
# Textarea
Form textarea component
```js
import { Textarea } from 'theme-ui'
```
```js live=true
<Textarea defaultValue="Hello" rows={8} />
```
## Variants
Textarea variants can be defined in `theme.forms` and the component uses the `theme.forms.textarea` variant by default.
| 7,811 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/components/variants.mdx | ---
title: Component Variants
---
import { Note } from '../..'
# Component Variants
Components use custom variants to allow you to completely customize the look and feel of each component.
The following table lists each component's variant group and default variant name where applicable.
| Component | Variant G... | 7,812 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/getting-started/gatsby.mdx | ---
title: Getting Started with Gatsby
---
# Getting Started with Gatsby
To use Theme UI with [Gatsby][], install and use
[`gatsby-plugin-theme-ui`](/packages/gatsby-plugin).
```sh
npm i theme-ui @theme-ui/mdx gatsby-plugin-theme-ui @emotion/react @mdx-js/react
```
Add the plugin to your `gatsby-config.js`.
```js
... | 7,813 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/getting-started/index.mdx | ---
title: Getting Started
---
import IntroCodeSamples from '../../components/intro-code-samples'
# Getting Started
Install Theme UI.
```sh
npm install theme-ui @emotion/react
```
Create a theme object to include custom color, typography, and layout values.
<IntroCodeSamples.ThemeCreation />
Pass your `theme` ob... | 7,814 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/color-mode-toggles.mdx | ---
title: Color Mode Toggles
---
# Color Mode Toggles
Create a button to toggle between light and dark [color modes](/color-modes).
```jsx
/** @jsxImportSource theme-ui */
import { useColorMode } from 'theme-ui'
export default (props) => {
const [mode, setMode] = useColorMode()
return (
<button
{...... | 7,815 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/custom-cache-provider.mdx | ---
title: Custom CacheProvider
---
# Custom CacheProvider
## Style container
You may come across a situation where you want to inject the generated styles
into a different element than the current document head (an iframe perhaps).
By using the CacheProvider from `@emotion/react` and `createCache` from
`@emotion/c... | 7,816 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/global-styles.mdx | ---
title: 'Global Styles'
---
# Global Styles
Theme UI offers a `Global` component (that wraps Emotion’s) for adding global
CSS with theme-based values.
By default (or, unless the
[`useRootStyles` configuration option](/theming#configuration-flags)is
disabled), the `ThemeUIProvider` component will apply styles in
... | 7,817 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/how-it-works.mdx | ---
title: How it Works
---
# How it Works
Theme UI combines several libraries together to form a mini-framework for
styling applications.
Theme UI is built with:
- [Emotion][]: used to generate isolated CSS with theming context
- [MDX][]: used to provide custom Emotion styled components to MDX documents,
without... | 7,818 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/index.mdx | ---
title: Guides
---
import { Cards } from '../..'
# Guides
<Cards width={320}>
- [How it Works](/guides/how-it-works) Implementation details for the core
library
- [JSX Pragma](/guides/jsx-pragma) Using JSX pragma to enable the `sx` prop
- [Motivation](/guides/motivation) Project background and prior art
- [Obj... | 7,819 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/jsx-pragma.mdx | ---
title: JSX Pragma
---
# JSX Pragma
Theme UI uses custom JSX functions and JSX import source comments to allow you
to style elements with values from your theme using the [`sx` prop][].
## What is JSX
[JSX](https://facebook.github.io/jsx/) is an XML-like syntax extension to
JavaScript. It's a syntax sugar usuall... | 7,820 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/keyframes.mdx | ---
title: 'Keyframes'
---
# CSS Keyframes
Using keyframes with Theme UI is fully supported, but not part of the Theme UI
library itself. Instead, use
[the `keyframes` helper from Emotion](https://emotion.sh/docs/keyframes).
## Usage
1. `import { keyframes } from '@emotion/react'`
2. Create a variable using `keyfra... | 7,821 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/layouts.mdx | ---
title: 'Layouts'
---
# Layouts
By leveraging the [variants](/guides/variants) feature, you can create custom themeable layout components.
The components can include some default styles,
but still allow users to override styles such as colors or typography, by changing values in the theme object.
To start, create... | 7,822 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/merging-themes.mdx | ---
title: 'Merging Themes'
---
# Merging Themes
Sometimes it's useful to split a theme across multiple files, use a preset as the basis for a custom theme, or combine two or more themes together.
Since themes are plain JavaScript objects, any merging strategy will work.
This guide shows a few common ways to merge th... | 7,823 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/motivation.mdx | ---
title: Motivation
---
# Motivation
One of the primary motivations behind Theme UI is to make building themeable,
constraint-based user interfaces in React as simple and as interoperable as
possible. This library builds upon years of work on various libraries, including
[Basscss][], [Tachyons][], [Rebass][], [Styl... | 7,824 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/nested-theme-providers.mdx | ---
title: 'Nested Theme Providers'
---
# Nested Theme Providers
While in most cases, you'll be using a `ThemeUIProvider` component at the root
of your application to set a site-wide theme, nested Theme Providers are a
powerful way to adjust styles contextually.
For example, when building a Gatsby theme, you may wan... | 7,825 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/object-styles.mdx | ---
title: Object Styles
---
# Object Styles
Authoring CSS in JavaScript object literal syntax can be a great way to catch syntax errors before committing code and use other features of JS syntax in styles.
If you're not used to writing styles in object literal syntax though, there are a few key differences to using ... | 7,826 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/responsive-typography.mdx | ---
title: 'Responsive Typography'
---
# Responsive Typography
While there are many different approaches to styling responsive typography on
the web, the [`theme.styles`][] API can be used to create rich, responsive
typography in MDX documents, with full control over the end result. Used in
combination with [responsi... | 7,827 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/styled-components.mdx | ---
title: 'Styled Components'
---
# Styled Components
Theme UI itself doesn’t expose an API for styled components, but works
seamlessly with the `styled` API from the [@emotion/styled][] package.
Components written with it should have access to the same theming context that
Theme UI uses.
Instead of using the `Them... | 7,828 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/theme-color-meta-tag.mdx | ---
title: 'Theme Color Meta Tag'
---
# Theme Color Meta Tag
_Learn more about `<meta />` theme color on
[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color)
and [CSS Tricks](https://css-tricks.com/meta-theme-color-and-trickery/)._
### with `useThemeUI`
Grab your theme from the con... | 7,829 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/typescript.mdx | ---
title: TypeScript
---
# TypeScript
Theme UI is written in TypeScript.
While most APIs in Theme UI should _just work_ in TypeScript,
there are a few advanced use cases which will differ slightly.
This guide is intended to cover those use cases.
## Exact theme type
The [`Theme` type](/theme-spec) represents all ... | 7,830 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/guides/variants.mdx | ---
title: 'Variants'
---
# Variants
To add groups of styles based on theme values, you can take advantage of the
_Variants_ feature. Variants allow you to define the styles used across multiple
buttons, typographic elements, or any element in your `theme` object.
For example, you can define `primary` and `secondary... | 7,831 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/mdx/components.mdx | ---
title: Custom MDX Components
---
# Custom MDX Components
To enrich components you’re passing to MDX context with styles defined in
[`theme.styles`](./styling), use `useThemedStylesWithMdx` with your
[`MDXProvider`](https://mdxjs.com/packages/react/#use).
```tsx
import { MDXProvider, useMDXComponents, MDXComponen... | 7,832 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/mdx/index.mdx | ---
title: MDX
---
import { Cards } from '../..'
# MDX
Theme UI is designed to work seamlessly with [MDX](https://mdxjs.com/), a format
allowing you to write JSX in your Markdown files & use Markdown files as React
components. This makes it easy to style text content with Theme UI and add
themed, interactive compone... | 7,833 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/mdx/layout-components.mdx | ---
title: 'MDX Layout Components'
---
# MDX Layout Components
The `ThemeUIProvider` component can be nested within a parent `ThemeUIProvider`,
allowing you to contextually adjust styles in certain parts of a UI. This
functionality can be leveraged to create custom layout components that take MDX
content as children ... | 7,834 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/mdx/linked-headings.mdx | ---
name: 'Linked Headings'
---
# Linked Headings
Create anchor-linked headings in MDX.
Use `remark-slug` with MDX to create IDs based on the heading’s content. If
you’re using Gatsby, add this to your `gatsby-plugin-mdx` options.
```js filename=gatsby-config.js
const remarkSlug = require('remark-slug')
module.exp... | 7,835 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/mdx/styling.mdx | ---
title: Styling MDX Content
---
# Styling MDX Content
The `theme.styles` object combined with `useThemeStylesWithMdx` hook is the
primary way to style content in MDX documents. This allows you to add
typographic styles to Markdown without the need to pollute the global scope.
Styles within this object have access ... | 7,836 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/mdx/syntax-highlighting.mdx | ---
title: 'Syntax Highlighting'
---
# Syntax Highlighting
To support syntax highlighting libraries like [Prism.js][], colors and other
styles can be added to `theme.styles.pre` to target child elements with class
selectors. Prism.js adds `<span>` elements with class names that can be used as
child selectors.
[prism... | 7,837 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/mdx/themed.mdx | ---
title: Themed
---
# Themed component
Use the `Themed` components dict to render UI with styles from
[`theme.styles`](/theming#styles) _outside_ of MDX or inside of more complex
components meant for embedding in MDX.
For example, if you'd like to reuse heading styles in a React component, you can
use the `Themed.... | 7,838 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/color.mdx | ---
title: '@theme-ui/color'
---
import Readme from '../../../../color/README.md'
<Readme />
| 7,839 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/components.mdx | ---
title: '@theme-ui/components'
---
import Readme from '../../../../components/README.md'
<Readme />
| 7,840 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/core.mdx | ---
title: '@theme-ui/core'
---
import Readme from '../../../../core/README.md'
<Readme />
| 7,841 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/css.mdx | ---
title: '@theme-ui/css'
---
import Readme from '../../../../css/README.md'
<Readme />
| 7,842 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/gatsby-plugin.mdx | ---
title: Gatsby Plugin
---
import Readme from '../../../../gatsby-plugin-theme-ui/README.md'
<Readme />
| 7,843 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/gatsby-theme-style-guide.mdx | ---
title: gatsby-theme-style-guide
---
import Readme from '../../../../style-guide/README.md'
<Readme />
[View Demo](/style-guide-demo)
| 7,844 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/gatsby-theme-ui-blog.mdx | ---
title: gatsby-theme-ui-blog
---
<strong>
`gatsby-theme-ui-blog` package was deprecated after Theme UI v0.3.1.
</strong>
---
# gatsby-theme-ui-blog
Minimal Gatsby MDX blog theme built with Theme UI. Use this as a starting point
for building custom blog themes with Theme UI.
```sh
npm i gatsby-theme-ui-blog
``... | 7,845 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/global.mdx | ---
title: '@theme-ui/global'
---
import Readme from '../../../../global/README.md'
<Readme />
| 7,846 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/index.mdx | ---
title: Packages
---
import { Cards } from '../..'
# Packages
In addition to the batteries-included library `theme-ui`, Theme UI includes
several optional packages.
<Cards width={320}>
- [@theme-ui/css](/packages/css)
- [@theme-ui/core](/packages/core)
- [@theme-ui/components](/packages/components)
- [@theme-ui... | 7,847 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/match-media.mdx | ---
title: '@theme-ui/match-media'
---
import Readme from '../../../../match-media/README.md'
<Readme />
| 7,848 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/mdx.mdx | ---
title: '@theme-ui/mdx'
---
import Readme from '../../../../mdx/README.md'
<Readme />
| 7,849 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/presets.mdx | ---
title: Presets
---
import Readme from '../../../../presets/README.md'
<Readme />
| 7,850 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/prism.mdx | ---
title: '@theme-ui/prism'
---
import Readme from '../../../../prism/README.md'
<Readme />
| 7,851 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/style-guide.mdx | ---
title: '@theme-ui/style-guide'
---
import { TypeScale, TypeStyle, ColorPalette } from '@theme-ui/style-guide'
import Readme from '../../../../style-guide/README.md'
<Readme />
## Demo
### Type Specimens
<TypeStyle fontSize={7}>System Font (Body)</TypeStyle>
<TypeStyle
fontFamily="heading"
fontWeight="headi... | 7,852 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/tachyons.mdx | import Readme from '../../../../tachyons/README.md'
<Readme />
| 7,853 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/tailwind.mdx | import Readme from '../../../../tailwind/README.md'
<Readme />
| 7,854 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/packages/typography.mdx | ---
title: '@theme-ui/typography'
---
import TypographyLayout from '../../components/typography-layout'
import Lorem from '../../components/lorem.mdx'
export default TypographyLayout
# @theme-ui/typography
This page uses themes from Typography.js to populate the `theme` object. Select
a theme from the controls abov... | 7,855 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/button.mdx | ---
name: 'Button'
---
# Button
Create a simple button component with variants.
```jsx live
<button
sx={{
appearance: 'none',
display: 'inline-block',
textAlign: 'center',
lineHeight: 'inherit',
textDecoration: 'none',
fontSize: 'inherit',
fontWeight: 'bold',
m: 0,
px: 3,
py... | 7,856 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/centered-container.mdx | ---
name: 'Centered Container'
---
# Centered Container
Create a centered, max-width container for reuse in multiple layouts.
```jsx live
<div
sx={{
maxWidth: 512,
mx: 'auto',
px: 3,
py: 4,
}}>
Centered
</div>
```
First, add a `container` size to your theme,
then use the size in your component... | 7,857 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/css-grid.mdx | ---
name: 'CSS Grid'
---
# CSS Grid
CSS Grid Layout is a powerful way to handle complex two-dimensional layouts.
Using Theme UI's `sx` prop gives you quick access to your space scale as well as
a quick way to change styles responsively.
```jsx live
<div
sx={{
display: 'grid',
gridGap: 4,
gridTemplateCo... | 7,858 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/flexbox-layout.mdx | ---
name: 'Flexbox Layout'
---
# Flexbox Layout
Create a simple page layout component with header and footer.
```jsx live=true xray=true
<div
sx={{
display: 'flex',
flexDirection: 'column',
// set this to `minHeight: '100vh'` for full viewport height
minHeight: 256,
}}>
<header
sx={{
... | 7,859 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/flexbox-sidebar.mdx | ---
name: 'Flexbox Sidebar'
---
# Flexbox Sidebar
Create a sidebar layout with flexbox that automatically stacks when the container is narrow.
```jsx live xray
<div
sx={{
display: 'flex',
flexWrap: 'wrap',
}}>
<aside
sx={{
flexGrow: 1,
flexBasis: 'sidebar',
}}>
Sidebar
</aside... | 7,860 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/footer-a1.mdx | ---
name: Footer A1
component: footer
---
# Footer A1
```jsx live=true
<footer
sx={{
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
p: 2,
variant: 'styles.footer',
}}>
<Link to="/" sx={{ variant: 'styles.navlink', p: 2 }}>
Home
</Link>
<Link to="/" sx={{ variant: 'styles.na... | 7,861 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/footer-a2.mdx | ---
name: Footer A2
component: footer
---
# Footer A2
```jsx live
<footer
sx={{
fontSize: 1,
color: 'background',
bg: 'text',
variant: 'styles.footer',
}}>
<div
sx={{
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
maxWidth: 768,
mx: 'auto',
px: 2... | 7,862 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/footer-a3.mdx | ---
name: Footer A3
component: footer
---
# Footer A3
```jsx live
<footer
sx={{
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
justifyContent: 'center',
p: 2,
variant: 'styles.footer',
}}>
<Link to="/" sx={{ variant: 'styles.navlink', p: 2 }}>
Home
</Link>
<Link to="/" ... | 7,863 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/footer-a4.mdx | ---
name: Footer A4
component: footer
---
# Footer A4
```jsx live
<footer
sx={{
fontSize: 1,
variant: 'styles.footer',
}}>
<div
sx={{
display: 'grid',
gridTemplateRows: 'repeat(4, 32px)',
gridTemplateColumns: ['repeat(2, 1fr)', 'repeat(4, 1fr)'],
gridAutoFlow: 'column',
... | 7,864 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/gatsby-link.mdx | ---
name: 'Gatsby Link'
---
# Gatsby Link
Add an active style to [Gatsby Link] or other React router link components.
Import the Theme UI [custom JSX pragma](/guides/jsx-pragma) for styling
the router link components directly, without using wrapper components.
```jsx live
<Link
to="/recipes/gatsby-link/"
activeC... | 7,865 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/grid.mdx | ---
name: CSS Grid Debugging
---
```jsx live xray
<div
sx={{
display: 'grid',
gridGap: 3,
gridTemplateColumns: 'repeat(2, 1fr)',
}}>
<div
sx={{
gridColumnStart: '1',
gridColumnEnd: '3',
}}>
A
</div>
<div>B</div>
<div>C</div>
</div>
```
| 7,866 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/header-a1.mdx | ---
name: Header A1
component: header
---
# Header A1
```jsx live
<header
sx={{
display: 'flex',
alignItems: 'center',
variant: 'styles.header',
}}>
<Link
to="/"
sx={{
variant: 'styles.navlink',
p: 2,
}}>
Hello
</Link>
<div sx={{ mx: 'auto' }} />
<Link
to="/blog... | 7,867 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/header-a2.mdx | ---
name: Header A2
component: header
---
# Header A2
```jsx live
<header
sx={{
variant: 'styles.header',
}}>
<div
sx={{
maxWidth: 768,
mx: 'auto',
px: 3,
display: 'flex',
alignItems: 'baseline',
}}>
<Link
to="/"
sx={{
variant: 'styles.navlink',
... | 7,868 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/header-a3.mdx | ---
name: Header A3
component: header
---
# Header A3
```jsx live
<header
sx={{
display: 'grid',
gridGap: 3,
maxWidth: 768,
mx: 'auto',
px: 3,
py: 3,
gridAutoFlow: 'row',
gridTemplateColumns: ['repeat(2, 1fr)', 'repeat(3, 1fr)'],
variant: 'styles.header',
}}>
<div
sx={{
... | 7,869 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/header-a4.mdx | ---
name: Header A4
component: header
---
# Header A4
```jsx live
<header
sx={{
display: 'grid',
gridGap: 3,
gridTemplateColumns: 'repeat(3, 1fr)',
px: 3,
py: 4,
alignItems: 'center',
variant: 'styles.header',
}}>
<button
title="Toggle Menu"
sx={{
appearance: 'none',
... | 7,870 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/header-a5.mdx | ---
name: Header A5
component: header
---
# Header A5
```jsx live
<header
sx={{
py: 4,
variant: 'styles.header',
}}>
<div
sx={{
display: 'flex',
justifyContent: 'center',
mb: 3,
}}>
<Link to="/" title="Home">
<img
alt="UI Logo"
src="https://contrast.no... | 7,871 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/index.js | // @ts-check
import { Themed } from '@theme-ui/mdx'
import { graphql, Link } from 'gatsby'
import { Cards } from '../..'
export const query = graphql`
{
allSitePage(filter: { path: { glob: "/recipes/*" } }) {
nodes {
id
path
pageContext
}
}
}
`
const RecipeListItem = (... | 7,872 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/mdx-table-align.mdx | ---
name: 'MDX Table Columns Align'
---
# MDX Table Columns Align
You can use standard MDX align styling to overwrite the column text align prop
```mdx
| Left | Centre | Right |
| :--- | :----: | ----: |
| 1 | 2 | 3 |
```
| Left | Centre | Right |
| :--- | :----: | ----: |
| 1 | 2 | 3 |
| 7,873 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/post-list-a1.mdx | ---
name: PostList A1
component: post-list
---
# PostList A1
```jsx live
<ul
sx={{
listStyle: 'none',
m: 0,
px: 3,
py: 4,
}}>
{posts.map((post) => (
<li
key={post.id}
sx={{
mb: 4,
}}>
<Themed.h2
sx={{
m: 0,
}}>
<Link
... | 7,874 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/post-list-a2.mdx | ---
name: PostList A2
component: post-list
---
# PostList A2
```jsx live
<ul
sx={{
listStyle: 'none',
display: 'grid',
gridGap: 3,
gridTemplateColumns: 'repeat(auto-fit, minmax(256px, 1fr))',
m: 0,
px: 3,
py: 4,
}}>
{posts.map((post) => (
<li key={post.id} sx={{}}>
<Themed.... | 7,875 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/stack.mdx | ---
name: 'Stack'
---
# Stack Layout
Add vertical space between child elements using CSS Grid.
```jsx live xray
<div
sx={{
display: 'grid',
gridGap: 4,
}}>
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
</div>
```
```jsx
/** @jsxImportSource theme-ui */
export default function S... | 7,876 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src/pages | petrpan-code/system-ui/theme-ui/packages/docs/src/pages/recipes/tiled-layout.mdx | ---
name: 'Tiled Layout'
---
# Tiled Layout
Create a responsive auto-sized tiled layout using CSS Grid.
```jsx live xray
<div
sx={{
display: 'grid',
gridGap: 3,
gridTemplateColumns: `repeat(auto-fit, minmax(128px, 1fr))`,
}}>
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
</di... | 7,877 |
0 | petrpan-code/system-ui/theme-ui/packages/docs/src | petrpan-code/system-ui/theme-ui/packages/docs/src/templates/preset.js | import React from 'react'
import Preset from '../components/preset'
export default function PresetTemplate({ pageContext: { preset } }) {
return <Preset preset={preset} />
}
| 7,878 |
0 | petrpan-code/system-ui/theme-ui/packages/docs | petrpan-code/system-ui/theme-ui/packages/docs/static/card.svg | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720" width="1280" height="720" style="display:block;color:white;width:1280px;height:720px"><rect width="1280" height="720" fill="black"></rect><g transform="translate(512 232)"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="256" height="256" ... | 7,879 |
0 | petrpan-code/system-ui/theme-ui/packages/docs | petrpan-code/system-ui/theme-ui/packages/docs/static/logo.svg | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="256" height="256" style="font-family:Inter, sans-serif;font-size:12px;letter-spacing:0.1em;fill:currentcolor;color:currentcolor;pointer-events:none"><defs><style type="text/css">
<![CDATA[
@font-face {
font-family: 'Inter';
font-style: normal;
fon... | 7,880 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/e2e/cypress.config.js | const { defineConfig } = require('cypress')
module.exports = defineConfig({
screenshotsFolder: 'screenshots',
videosFolder: 'videos',
downloadsFolder: 'downloads',
fixturesFolder: 'fixtures',
retries: {
runMode: 1,
openMode: 3,
},
projectId: 'fmfid1',
e2e: {
// We've imported your old cypre... | 7,881 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/e2e/package.json | {
"name": "e2e",
"private": true,
"version": "0.16.2-develop.0",
"description": "Cypress tests ran against Theme UI docs and examples",
"scripts": {
"open": "cypress open",
"start": "percy exec -- cypress run",
"record": "wait-on 'http://localhost:9000' && percy exec -- cypress run --record",
... | 7,882 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/e2e/plugins.js | // ***********************************************************
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
const esbuildP... | 7,883 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/e2e/support.ts | /// <reference types="cypress" />
import * as toolbelt from 'ts-toolbelt'
// Workaround for @testing-library/dom problem.
// We should be able remove it in the future.
if (typeof global === 'undefined') {
Object.assign(window, { global: window })
}
require('@testing-library/cypress/add-commands')
require('@percy/cy... | 7,884 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/e2e/tsconfig.json | {
"extends": "../../tsconfig.options.json",
"compilerOptions": {
"types": ["cypress", "node", "@percy/cypress", "@testing-library/cypress"]
},
"files": [],
"include": [
"../../node_modules/cypress",
"../../node_modules/@testing-library/cypress",
"../../node_modules/@percy/cypress",
"./inte... | 7,885 |
0 | petrpan-code/system-ui/theme-ui/packages/e2e | petrpan-code/system-ui/theme-ui/packages/e2e/integration/docs-color-modes.ts | const visit = ({
preferredColorScheme,
}: {
preferredColorScheme: 'dark' | 'light' | null
}) => {
cy.visit('/', {
onBeforeLoad(win) {
const _matchMedia = win.matchMedia
win.matchMedia = (query: string) => {
if (query.includes('prefers-color-scheme:')) {
const queried = query.matc... | 7,886 |
0 | petrpan-code/system-ui/theme-ui/packages/e2e | petrpan-code/system-ui/theme-ui/packages/e2e/integration/docs-navigation.ts | describe('docs navigation', () => {
it('works without 404', () => {
cy.visit('/')
cy.findByText('Documentation').click()
cy.location().should('have.property', 'pathname', '/getting-started')
cy.findByText('Theming').click({ force: true })
cy.get('h1').should('have.text', 'Theming')
cy.findAllB... | 7,887 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/CHANGELOG.md | # v0.13.0 (Mon Dec 27 2021)
### Release Notes
#### Move Emotion and MDX packages to peerDeps ([#1867](https://github.com/system-ui/theme-ui/pull/1867))
**BREAKING CHANGE:** `@emotion/react` and `@mdx-js/react` were moved to peerDependencies of `theme-ui`, `@theme-ui/mdx` and `@theme-ui/sidenav` and must be installe... | 7,888 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/README.md | # gatsby-plugin-theme-ui
Gatsby plugin for adding Theme UI context
```sh
npm i theme-ui @theme-ui/mdx gatsby-plugin-theme-ui @emotion/react @mdx-js/react
```
```js
// gatsby-config.js
module.exports = {
plugins: ['gatsby-plugin-theme-ui'],
}
```
In addition to providing context, this plugin will also prevent a fl... | 7,889 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/gatsby-browser.js | import * as React from 'react'
import { WrapRootElement } from './src/provider'
export const wrapRootElement = ({ element }) =>
React.createElement(WrapRootElement, { element })
| 7,890 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/gatsby-node.js | const prismPresetDictionary = require(`./utils/preset-dictionary`)
exports.onPreInit = ({ reporter }, options) => {
let { preset, prismPreset } = options
if (typeof preset === 'string') {
try {
options.preset = require(preset)
} catch {
reporter.warn(
`It appears your theme dependency ... | 7,891 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/gatsby-ssr.js | import * as React from 'react'
import { jsx, InitializeColorMode } from 'theme-ui'
import { WrapRootElement } from './src/provider'
export const onRenderBody = (
{ setPreBodyComponents },
{ injectColorFlashScript = true }
) => {
if (injectColorFlashScript) {
setPreBodyComponents([
jsx(InitializeColorMo... | 7,892 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/index.js | export { default } from './src'
| 7,893 |
0 | petrpan-code/system-ui/theme-ui/packages | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/package.json | {
"name": "gatsby-plugin-theme-ui",
"version": "0.16.2-develop.0",
"main": "dist/gatsby-plugin-theme-ui.cjs.js",
"module": "dist/gatsby-plugin-theme-ui.esm.js",
"browser": {
"./dist/gatsby-plugin-theme-ui.esm.js": "./dist/gatsby-plugin-theme-ui.browser.esm.js"
},
"exports": {
".": {
"module"... | 7,894 |
0 | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/src/components.js | // add custom MDX components here
const components = {}
export default components
| 7,895 |
0 | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/src/index.js | import { makeTheme } from '@theme-ui/css/utils'
// add colors, fonts, fontSizes, space, etc
const theme = makeTheme({})
export default theme
| 7,896 |
0 | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/src/provider.js | import { ThemeUIProvider, merge } from 'theme-ui'
import { useThemedStylesWithMdx } from '@theme-ui/mdx'
import React from 'react'
import localTheme from './index'
import components from './components'
import useThemeUiConfig from './hooks/configOptions'
import { MDXProvider, useMDXComponents } from '@mdx-js/react'
... | 7,897 |
0 | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/src | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/src/hooks/configOptions.js | import { useStaticQuery, graphql } from 'gatsby'
const useThemeUiConfig = () => {
const data = useStaticQuery(graphql`
query {
themeUiConfig(id: { eq: "gatsby-plugin-theme-ui-config" }) {
preset
prismPreset
}
}
`)
return data.themeUiConfig
}
export default useThemeUiConfig
| 7,898 |
0 | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui | petrpan-code/system-ui/theme-ui/packages/gatsby-plugin-theme-ui/test/provider-v2.skipped | // @ts-nocheck
import { useThemeUI } from 'theme-ui'
import { WrapRootElement } from '../src/provider'
import { jest } from '@jest/globals'
import _theme from '../src'
jest.unstable_mockModule('gatsby', () => ({
graphql: jest.fn(),
useStaticQuery: jest.fn(() => ({
themeUiConfig: {
preset: {},
prism... | 7,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.