diff --git a/docs/src/app/not-found.tsx b/docs/src/app/not-found.tsx
index e14cfea38e..4be656f12b 100644
--- a/docs/src/app/not-found.tsx
+++ b/docs/src/app/not-found.tsx
@@ -21,7 +21,7 @@ export default function NotFound() {
className="-m-1 inline-flex items-center gap-1 p-1"
href="/react/overview/quick-start"
>
- Documentation
+ Documentation
diff --git a/docs/src/components/HeadingLink.css b/docs/src/components/HeadingLink.css
new file mode 100644
index 0000000000..c7ad4d9548
--- /dev/null
+++ b/docs/src/components/HeadingLink.css
@@ -0,0 +1,26 @@
+.HeadingLink {
+ &:focus-visible {
+ outline: 2px solid var(--color-blue);
+ outline-offset: -2px;
+ border-radius: var(--radius-sm);
+ }
+
+ @media (pointer: fine) {
+ & svg {
+ visibility: hidden;
+ }
+ }
+
+ @media (hover: hover) {
+ &:hover {
+ text-decoration: underline;
+ text-underline-offset: 2px;
+ text-decoration-thickness: 1px;
+ text-decoration-color: color-mix(in oklab, var(--color-gray), transparent);
+ }
+
+ &:hover svg {
+ visibility: visible;
+ }
+ }
+}
diff --git a/docs/src/components/HeadingLink.tsx b/docs/src/components/HeadingLink.tsx
new file mode 100644
index 0000000000..3320ea3ac5
--- /dev/null
+++ b/docs/src/components/HeadingLink.tsx
@@ -0,0 +1,21 @@
+import * as React from 'react';
+import clsx from 'clsx';
+import { LinkIcon } from 'docs/src/icons/LinkIcon';
+
+export function HeadingLink({
+ children,
+ className,
+ id,
+ ...otherProps
+}: React.ComponentPropsWithoutRef<'a'>) {
+ return (
+
+ {children}
+
+
+ );
+}
diff --git a/docs/src/components/Link.tsx b/docs/src/components/Link.tsx
index 46eb6c09a0..17ce81894c 100644
--- a/docs/src/components/Link.tsx
+++ b/docs/src/components/Link.tsx
@@ -19,7 +19,7 @@ export function Link({ href, className, ...props }: React.ComponentProps
{props.children}
-
+
);
}
diff --git a/docs/src/icons/LinkIcon.tsx b/docs/src/icons/LinkIcon.tsx
new file mode 100644
index 0000000000..2c65a39d60
--- /dev/null
+++ b/docs/src/icons/LinkIcon.tsx
@@ -0,0 +1,16 @@
+import * as React from 'react';
+
+export function LinkIcon(props: React.ComponentProps<'svg'>) {
+ return (
+
+ );
+}
diff --git a/docs/src/mdx-components.tsx b/docs/src/mdx-components.tsx
index e5354b03d6..cd3df2cf64 100644
--- a/docs/src/mdx-components.tsx
+++ b/docs/src/mdx-components.tsx
@@ -9,6 +9,7 @@ import { AttributesReferenceTable } from './components/ReferenceTable/Attributes
import { CssVariablesReferenceTable } from './components/ReferenceTable/CssVariablesReferenceTable';
import { getChildrenText } from './utils/getChildrenText';
import { Link } from './components/Link';
+import { HeadingLink } from './components/HeadingLink';
import { Subtitle } from './components/Subtitle/Subtitle';
import { Kbd } from './components/Kbd/Kbd';
@@ -26,16 +27,32 @@ export const mdxComponents: MDXComponents = {
{`${getChildrenText(props.children)} ยท Base UI`}
),
- h2: (props) => (
- // Do not wrap heading tags in divs, that confuses Safari Reader
-
-
-
-
- ),
- h3: (props) => (
-
- ),
+ h2: ({ children, id, ...otherProps }) => {
+ return (
+ // Do not wrap heading tags in divs, that confuses Safari Reader
+
+
+ {children}
+
+
+
+ );
+ },
+ h3: ({ children, id, ...otherProps }) => {
+ return (
+
+ {children}
+
+ );
+ },
h4: (props) => ,
h5: (props) => ,
h6: (props) => ,
diff --git a/docs/src/styles.css b/docs/src/styles.css
index bb92f43585..65437a2253 100644
--- a/docs/src/styles.css
+++ b/docs/src/styles.css
@@ -32,6 +32,7 @@
@import './components/Demo/Demo.css';
@import './components/GhostButton.css';
@import './components/Header.css';
+@import './components/HeadingLink.css';
@import './components/Kbd/Kbd.css';
@import './components/Link.css';
@import './components/MobileNav.css';