@@ -404,6 +454,8 @@ export const MDXComponents = {
pre: CodeBlock,
CodeDiagram,
ConsoleBlock,
+ ConsoleBlockMulti,
+ ConsoleLogLine,
DeepDive: (props: {
children: React.ReactNode;
title: string;
@@ -424,16 +476,19 @@ export const MDXComponents = {
IllustrationBlock,
Intro,
InlineToc,
+ LanguageList,
LearnMore,
Math,
MathI,
Note,
Canary,
+ CanaryBadge,
PackageImport,
ReadBlogPost,
Recap,
Recipes,
Sandpack,
+ SandpackWithHTMLOutput,
TeamMember,
TerminalBlock,
YouWillLearn,
diff --git a/src/components/MDX/Sandpack/SandpackRoot.tsx b/src/components/MDX/Sandpack/SandpackRoot.tsx
index d47fd903c..a47fa6860 100644
--- a/src/components/MDX/Sandpack/SandpackRoot.tsx
+++ b/src/components/MDX/Sandpack/SandpackRoot.tsx
@@ -88,7 +88,7 @@ function SandpackRoot(props: SandpackProps) {
autorun,
initMode: 'user-visible',
initModeObserverOptions: {rootMargin: '1400px 0px'},
- bundlerURL: 'https://1e4ad8f7.sandpack-bundler-4bw.pages.dev',
+ bundlerURL: 'https://786946de.sandpack-bundler-4bw.pages.dev',
logLevel: SandpackLogLevel.None,
}}>
diff --git a/src/components/MDX/Sandpack/createFileMap.ts b/src/components/MDX/Sandpack/createFileMap.ts
index 85c7f09bf..615d34c9a 100644
--- a/src/components/MDX/Sandpack/createFileMap.ts
+++ b/src/components/MDX/Sandpack/createFileMap.ts
@@ -11,7 +11,10 @@ export const SUPPORTED_FILES = [AppJSPath, StylesCSSPath];
export const createFileMap = (codeSnippets: any) => {
return codeSnippets.reduce(
(result: Record
, codeSnippet: React.ReactElement) => {
- if ((codeSnippet.type as any).mdxName !== 'pre') {
+ if (
+ (codeSnippet.type as any).mdxName !== 'pre' &&
+ codeSnippet.type !== 'pre'
+ ) {
return result;
}
const {props} = codeSnippet.props.children;
diff --git a/src/components/MDX/SandpackWithHTMLOutput.tsx b/src/components/MDX/SandpackWithHTMLOutput.tsx
new file mode 100644
index 000000000..51ce28dc1
--- /dev/null
+++ b/src/components/MDX/SandpackWithHTMLOutput.tsx
@@ -0,0 +1,85 @@
+import {Children, memo} from 'react';
+import InlineCode from './InlineCode';
+import Sandpack from './Sandpack';
+
+const ShowRenderedHTML = `
+import { renderToStaticMarkup } from 'react-dom/server';
+import formatHTML from './formatHTML.js';
+
+export default function ShowRenderedHTML({children}) {
+ const markup = renderToStaticMarkup(
+
+
+ {children}
+
+ );
+ return (
+ <>
+
Rendered HTML:
+
+ {formatHTML(markup)}
+
+ >
+ );
+}`;
+
+const formatHTML = `
+import format from 'html-format';
+
+export default function formatHTML(markup) {
+ // Cheap tricks to format the HTML readably -- haven't been able to
+ // find a package that runs in browser and prettifies the HTML if it
+ // lacks line-breaks.
+ return format(markup
+ .replace('', '\\n')
+ .replace('', '\\n')
+ .replaceAll(/<\\/script>/g, '<\\/script>\\n')
+ .replaceAll(/`), require careful positioning in the DOM due to style precedence rules. Building a stylesheet capability that allows for composability within components is hard, so users often end up either loading all of their styles far from the components that may depend on them, or they use a style library which encapsulates this complexity.
+
+In React 19, we're addressing this complexity and providing even deeper integration into Concurrent Rendering on the Client and Streaming Rendering on the Server with built in support for stylesheets. If you tell React the `precedence` of your stylesheet it will manage the insertion order of the stylesheet in the DOM and ensure that the stylesheet (if external) is loaded before revealing content that depends on those style rules.
+
+```js {4,5,17}
+function ComponentOne() {
+ return (
+
+
+
+
+ {...}
+
+
+ )
+}
+
+function ComponentTwo() {
+ return (
+
+
{...}
+
<-- will be inserted between foo & bar
+
+ )
+}
+```
+
+During Server Side Rendering React will include the stylesheet in the ``, which ensures that the browser will not paint until it has loaded. If the stylesheet is discovered late after we've already started streaming, React will ensure that the stylesheet is inserted into the `` on the client before revealing the content of a Suspense boundary that depends on that stylesheet.
+
+During Client Side Rendering React will wait for newly rendered stylesheets to load before committing the render. If you render this component from multiple places within your application React will only include the stylesheet once in the document:
+
+```js {5}
+function App() {
+ return <>
+
+ ...
+
// won't lead to a duplicate stylesheet link in the DOM
+ >
+}
+```
+
+For users accustomed to loading stylesheets manually this is an opportunity to locate those stylesheets alongside the components that depend on them allowing for better local reasoning and an easier time ensuring you only load the stylesheets that you actually depend on.
+
+Style libraries and style integrations with bundlers can also adopt this new capability so even if you don't directly render your own stylesheets, you can still benefit as your tools are upgraded to use this feature.
+
+For more details, read the docs for [`
`](/reference/react-dom/components/link) and [`
+```
+
+
+
+
+
+---
+
+## Reference {/*reference*/}
+
+### `
+```
+
+[See more examples below.](#usage)
+
+#### Props {/*props*/}
+
+`
+
+ >
+ );
+}
+
+export default function App() {
+ return (
+
+
+
+ );
+}
+```
+
+
diff --git a/src/content/reference/react-dom/components/title.md b/src/content/reference/react-dom/components/title.md
new file mode 100644
index 000000000..24b2aba2f
--- /dev/null
+++ b/src/content/reference/react-dom/components/title.md
@@ -0,0 +1,98 @@
+---
+title: "
"
+canary: true
+---
+
+
+
+React's extensions to `` are currently only available in React's canary and experimental channels. In stable releases of React `` works only as a [built-in browser HTML component](https://react.dev/reference/react-dom/components#all-html-components). Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
+
+
+
+
+
+
+The [built-in browser `` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title) lets you specify the title of the document.
+
+```js
+My Blog
+```
+
+
+
+
+
+---
+
+## Reference {/*reference*/}
+
+### `` {/*title*/}
+
+To specify the title of the document, render the [built-in browser `` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title). You can render `` from any component and React will always place the corresponding DOM element in the document head.
+
+```js
+My Blog
+```
+
+[See more examples below.](#usage)
+
+#### Props {/*props*/}
+
+`` supports all [common element props.](/reference/react-dom/components/common#props)
+
+* `children`: `` accepts only text as a child. This text will become the title of the document. You can also pass your own components as long as they only render text.
+
+#### Special rendering behavior {/*special-rendering-behavior*/}
+
+React will always place the DOM element corresponding to the `` component within the document’s ``, regardless of where in the React tree it is rendered. The `` is the only valid place for `` to exist within the DOM, yet it’s convenient and keeps things composable if a component representing a specific page can render its `` itself.
+
+There are two exception to this:
+* If `` is within an `