The site renders to plain static HTML, but any MDX article can embed a React component as an interactive island. Only the component you mark with a client:* directive ships JavaScript; the rest of the page stays static.
Try it
Drag the sliders to estimate how long a download takes at a given connection speed. The component is hydrated when it scrolls into view.
Estimated time: 13 min 20 s
Add your own component
Write a .tsx component and keep it in src/components/react/ when several articles share it, or next to the article in its bundle when only one uses it.
import { useState } from 'react';
export default function Hello({ name = 'world' }: { name?: string }) { const [count, setCount] = useState(0); return ( <button onClick={() => setCount(count + 1)}> Hello, {name}! Clicked {count} times. </button> );}Import it in an .mdx article with the @components alias and add a client directive:
import Hello from '@components/react/Hello';
<Hello client:load name="reader" />Choosing a client directive
| Directive | Hydrates | Use it for |
|---|---|---|
client:load | Immediately on page load | Controls visible at the top of the article |
client:idle | When the browser is idle | Lower-priority interactive widgets |
client:visible | When scrolled into view | Charts and widgets further down the page |
client:only="react" | In the browser only, no server render | Components that need browser-only APIs |
| no directive | Never; static HTML only | Components that only display content |
Pass lang to components that show text so they can match the article language, and use Intl.NumberFormat for numerals so Bengali and English readers each see their own digits.