# @theme-ui/mdx

> [MDX](https://mdxjs.com) utilities for [Theme UI](https://theme-ui.com)

Latest version **0.17.4** (published 2026-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @theme-ui/mdx
pnpm add @theme-ui/mdx
yarn add @theme-ui/mdx
bun add @theme-ui/mdx
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.17.4 |
| Published | 2026-01-02 |
| First published | 2019-12-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 33.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5413 |
| Author | Brent Jackson |
| Maintainers | jxnblk, johno, hasparus, lachlanjc |

## Links

- npm: https://www.npmjs.com/package/@theme-ui/mdx
- Repository: https://github.com/system-ui/theme-ui
- Homepage: https://github.com/system-ui/theme-ui#readme
- Issues: https://github.com/system-ui/theme-ui/issues
- npm.io page: https://npm.io/package/@theme-ui/mdx

## Dependencies (2)

- [@theme-ui/css](https://npm.io/package/@theme-ui/css.md) ^0.17.4
- [@theme-ui/core](https://npm.io/package/@theme-ui/core.md) ^0.17.4

## Recent versions

- 0.17.4 (latest) — 2026-01-02
- 0.17.2-develop.1 (develop) — 2025-02-14
- 0.16.2-scale-tuples.0 (canary) — 2023-09-26
- 0.6.0-alpha.8 (next) — 2021-03-19
- 0.4.0-highlight.0 (highlight) — 2020-05-08
- 0.17.2 — 2025-02-14
- 0.17.2-develop.0 — 2024-12-18
- 0.17.1 — 2024-10-24
- 0.17.1-develop.0 — 2024-10-24
- 0.17.0 — 2024-10-18
- 0.17.0-develop.1 — 2024-10-18
- 0.17.0-develop.0 — 2024-10-18
- 0.16.2 — 2024-02-19
- 0.16.2-develop.5 — 2024-02-19
- 0.16.2-develop.2 — 2024-01-05
- … 407 more at https://npm.io/package/@theme-ui/mdx/versions

## README

# @theme-ui/mdx

[MDX](https://mdxjs.com) utilities for [Theme UI](https://theme-ui.com)

```sh
npm i @theme-ui/mdx
```

## API

### `useThemedStylesWithMdx`

Wraps an object of components provided to `MDXProvider` with styles from
`theme.styles`.

**Example usage:**

```tsx
import {
  MDXProvider,
  useMDXComponents,
  Components as MDXComponents,
  MergeComponents as MergeMDXComponents,
} from '@mdx-js/react'
import { useThemedStylesWithMdx } from '@theme-ui/mdx'
import { ThemeUIProvider, Theme } from 'theme-ui'

interface MyProviderProps {
  theme: Theme
  components?: MDXComponents | MergeMDXComponents
  children: React.ReactNode
}
function MyProvider({ theme, components, children }: MyProviderProps) {
  const componentsWithStyles = useThemedStylesWithMdx(
    useMDXComponents(components)
  )

  return (
    <ThemeUIProvider theme={theme}>
      <MDXProvider components={componentsWithStyles}>{children}</MDXProvider>
    </ThemeUIProvider>
  )
}
```

### `Themed`

Use the [`Themed` components dictionary](https://theme-ui.com/mdx/themed) to
render UI with styles from [`theme.styles`](https://theme-ui.com/theming#styles)
_outside_ of MDX. These are primarily meant as a mechanism to use styles defined
in a `theme` object outside of MDX, which can then be embedded in JSX>

```jsx
// picks up styles from `theme.styles.h1`
<Themed.h1 />
```

If you’re looking to automatically hyperlink headings in MDX, check out the
[linked headings guide](https://theme-ui.com/mdx/linked-headings).)

---

**Other exports**

- `themed`
- `defaultMdxComponents`

---
_Source: https://npm.io/package/@theme-ui/mdx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
