Code Snippets
Dark code blocks with horizontal scrolling
Universal component for expandable code blocks and content sections. Zero CSS in your pages, full WCAG compliance built-in.
Stop writing repetitive CSS for show/hide functionality. ContentToggle gives you:
<details> element (no JavaScript needed)Perfect for showing copy-paste code examples in component showcases.
<BusinessInfo variant="full" /> Longer examples automatically get horizontal scroll on mobile.
<Hero
variant="centered"
heading="Welcome to Our Site"
description="A longer code example to demonstrate horizontal scrolling on mobile devices"
buttonText="Get Started"
buttonHref="/contact"
/>
Use type="content" for regular HTML or markdown content.
This is regular content inside a toggle. It supports markdown, HTML, and all the typical prose styling.
The prose styling automatically adapts to light and dark modes, ensuring WCAG AA compliance across all 8 color presets.
const x = 5;
Stack multiple toggles with consistent spacing using space-y-4.
import ContentToggle from '@theme/components/ui/ContentToggle.astro'; <ContentToggle summary="Show Code" type="code" code="..." /> <ContentToggle summary="Details" type="content">
<p>Your content here</p>
</ContentToggle> "code" or "content" (default: "content")
type="code")
"default" or "subtle" - adapts to
section background
background="default" - Use on white/slate-950 backgrounds (ContentSection background="default")
background="subtle" - Use on gray-50/slate-900 backgrounds (ContentSection background="subtle")
Code blocks:
Summary text:
Focus rings:
Mobile:
Dark code blocks with horizontal scrolling
Prose styling for HTML and markdown
15.68:1+ contrast ratios
44px touch targets, responsive
Add ContentToggle to your showcase pages for consistent, accessible code examples with zero CSS.