shelving
Version:
Toolkit for using data in JavaScript.
12 lines (11 loc) • 766 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { getClass, getModuleClass } from "../util/css.js";
import styles from "./Preformatted.module.css";
/**
* Preformatted block of text — rendered as `<pre>`.
* - Defaults to wrapping long lines (`white-space: pre-wrap`) so code fits the container width while preserving newlines and indentation within wrapped lines.
* - Pass `nowrap` to restore strict `<pre>` behaviour when exact whitespace matters (ASCII art, fixed-column tables). Wrap in a `<Figure scrollable>` (or any `scrollable` block) to add horizontal scrolling.
*/
export function Preformatted({ children, ...variants }) {
return _jsx("pre", { className: getClass(getModuleClass(styles, "preformatted", variants)), children: children });
}