1. CSS variables (recommended for theming)
All colors, borders, and radii in Streamdown resolve from the same CSS custom properties that shadcn/ui uses. Defining these variables in yourglobals.css is the most concise way to retheme the entire component.
Variables used by Streamdown
| Variable | Where it appears |
|---|---|
--primary | Link color (<a> elements) |
--muted | Inline code background, table header background, code block background |
--muted-foreground | Blockquote text, de-emphasized labels |
--border | Table borders, horizontal rules, code block borders |
--ring | Focus rings on copy / download buttons |
--radius | Border radius on code blocks, tables, and buttons |
--sidebar | Mermaid diagram container background |
--background | Inner panel of Mermaid containers |
Setting up variables
Add the variables to yourglobals.css inside a @layer base block so Tailwind can apply them at the correct cascade layer:
app/globals.css
Quick theme examples
- Minimal gray
- Vibrant blue
- Borderless
app/globals.css
2. Importing the stylesheet
Streamdown ships a small stylesheet for animation keyframes. Import it once at the root of your application:app/layout.tsx
@keyframes rules (sd-fadeIn, sd-blurIn, sd-slideUp) and the [data-sd-animate] selector that the animation plugin uses. You do not need to import it if you are not using the animated prop.
3. Tailwind CSS integration
Standard setup
Streamdown’s internal classes use standard Tailwind utility names. If your project already has Tailwind configured, no additional setup is required — the classes will be included in your build as long as Streamdown’s source is included in the Tailwind content scan. For Tailwind v4, add Streamdown’s package to the@source directive:
app/globals.css
Tailwind prefix support
If your Tailwind v4 config uses theprefix() function, pass the same prefix to the prefix prop so Streamdown’s internal class names match:
app/page.tsx
app/globals.css
4. Global CSS with data-streamdown selectors
Every element rendered by Streamdown carries a data-streamdown attribute. Use these attributes in your global CSS to style individual element types without replacing the entire component.
Available selectors
styles/streamdown.css
Example: custom heading and link styles
styles/streamdown.css
Scoping styles to a single instance
Use theclassName prop together with a descendant selector to apply styles only to a specific Streamdown instance:
app/page.tsx
styles/streamdown.css
5. Custom components (structural changes)
When CSS alone is not enough — for example, when you need to add wrapper elements, change the HTML tag, or inject React components — use thecomponents prop. See the Components page.
Styling priority
When multiple approaches target the same element, the effective priority is:- Custom components — full control; replaces all default output including styles
data-streamdownCSS selectors — element-specific visual overrides- CSS variables — global design tokens for colors, radius, and spacing
Best practices
- Start with CSS variables for broad color and spacing changes.
- Use
data-streamdownselectors when you need to target specific element types without replacing their default structure. - Use custom components only when you need structural or behavioral changes.
- Test your styles with
isAnimating={true}and partial content to verify they work correctly during streaming. - Use the
classNameprop to scope styles and avoid leaking them into other parts of your UI.
