Code Block
Code to read and copy: file name, line numbers, highlighted lines and a monochrome syntax in weight and light. Copy rolls to Copied; a terminal copies its commands only.
View codeLines that draw themselves from their middle when they come into view: a plain rule, one with a label or a section title, one around a CSS dot, and verticals between items.
With your AI
Say it to your AI. It gets the exact code below, not its best guess, and knows where it goes.
Separate my page sections with Kodza Separators.
claude mcp add -t http kodza https://kodza.dev/api/mcp
<div class="kodza-separator kodza-separator--label kodza-separator--start" role="separator"><span>02 — Install</span></div>
<hr class="kodza-separator" />
<div class="kodza-separator kodza-separator--label" role="separator"><span>or</span></div>
<div class="kodza-separator kodza-separator--dot" role="separator"></div>
<p class="kodza-separator-row">
<span>v2.0.1</span>
<span class="kodza-separator kodza-separator--vertical" role="separator" aria-orientation="vertical"></span>
<span>MIT</span>
<span class="kodza-separator kodza-separator--vertical" role="separator" aria-orientation="vertical"></span>
<span>0 dependencies</span>
<span class="kodza-separator kodza-separator--vertical" role="separator" aria-orientation="vertical"></span>
<span>2.1 KB</span>
</p>
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Separator
A line that draws itself from its middle (or from its label) when it comes into view. A plain
rule (an hr), --label ("or", or a section title with --start), --dot (a round in the middle)
and --vertical, between items of a .kodza-separator-row. Without the script, the lines are
simply there. "kodza:replay" draws one again.
Everything is tuned with the --kz-separator-* variables. */
.kodza-separator,
.kodza-separator-row {
--kz-separator-line: rgba(10, 10, 10, 0.16);
--kz-separator-fg: #0a0a0a;
--kz-separator-muted: rgba(10, 10, 10, 0.6);
--kz-separator-ease: cubic-bezier(0.65, 0, 0.35, 1);
--kz-separator-duration: 0.9s;
}
/* The plain rule */
hr.kodza-separator {
height: 1px;
margin: 0;
border: 0;
background: var(--kz-separator-line);
transition: transform var(--kz-separator-duration) var(--kz-separator-ease);
}
/* Label and dot: two lines either side of something */
.kodza-separator--label,
.kodza-separator--dot {
display: flex;
align-items: center;
gap: 14px;
color: var(--kz-separator-muted);
font-size: 13px;
}
.kodza-separator--label::before,
.kodza-separator--label::after,
.kodza-separator--dot::before,
.kodza-separator--dot::after {
content: "";
flex: 1;
height: 1px;
background: var(--kz-separator-line);
transition: transform var(--kz-separator-duration) var(--kz-separator-ease);
}
/* Each line grows away from the middle */
.kodza-separator--label::before,
.kodza-separator--dot::before {
transform-origin: 100% 50%;
}
.kodza-separator--label::after,
.kodza-separator--dot::after {
transform-origin: 0 50%;
}
.kodza-separator--label > span {
transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
/* A section title: the label on the left, one line after it, in mono */
.kodza-separator--start::before {
display: none;
}
.kodza-separator--start > span {
color: var(--kz-separator-fg);
font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
font-size: 12px;
letter-spacing: 0.02em;
}
/* The dot: a small round drawn in CSS */
.kodza-separator--dot {
gap: 18px;
}
.kodza-separator--dot {
background: radial-gradient(circle, var(--kz-separator-fg) 2.5px, transparent 3px) center / 6px 6px no-repeat;
}
/* Vertical, between items on a line */
.kodza-separator-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 14px;
margin: 0;
color: var(--kz-separator-muted);
font-size: 14px;
}
.kodza-separator--vertical {
display: inline-block;
width: 1px;
height: 14px;
background: var(--kz-separator-line);
transition: transform var(--kz-separator-duration) var(--kz-separator-ease);
}
/* Waiting to be drawn (only once the script is there) */
hr.kodza-separator.is-ready:not(.is-drawn) {
transform: scaleX(0);
}
.kodza-separator.is-ready:not(.is-drawn)::before,
.kodza-separator.is-ready:not(.is-drawn)::after {
transform: scaleX(0);
}
.kodza-separator--label.is-ready:not(.is-drawn) > span {
opacity: 0;
transform: translateY(6px);
}
.kodza-separator--vertical.is-ready:not(.is-drawn) {
transform: scaleY(0);
}
/* Reset at once before drawing again */
.kodza-separator.is-resetting,
.kodza-separator.is-resetting::before,
.kodza-separator.is-resetting::after,
.kodza-separator.is-resetting > span {
transition: none;
}
@media (prefers-reduced-motion: reduce) {
.kodza-separator,
.kodza-separator::before,
.kodza-separator::after,
.kodza-separator > span {
transition: none !important;
}
}
/* Theming example — on a dark background:
.dark-section .kodza-separator,
.dark-section .kodza-separator-row {
--kz-separator-line: rgba(255, 255, 255, 0.18);
--kz-separator-fg: #f2f2f0;
--kz-separator-muted: rgba(242, 242, 240, 0.6);
}
*/
/* kodza-guard ba8e8c173b3a — generated by Kodza, do not edit.
Theme guard: keeps a site's own CSS (WordPress themes, Bootstrap, CSS resets…) off this
component. :not(#_) is always true and weighs as much as an id, so these lines win over
theme rules made of classes and tags. Customise the component through its --kz-* variables. */
/* What the browser gives, where the component sets it only in some states: at the lowest weight, so its own rules below put it back */
:where(.kodza-separator):not(#_) {
border: revert;
}
/* What the browser gives, on everything the component leaves to it */
.kodza-separator:not(#_) {
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
position: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-height: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-separator span:where(:not([class*="kodza-"])):not(#_) {
box-sizing: revert;
}
.kodza-separator:not(#_)::before,
.kodza-separator:not(#_)::after {
box-sizing: revert;
}
/* The component's own rules, one step stronger: real buttons and fields, what it sets on tags themes style (links, lists, headings, images…), and the root width (a theme may narrow it, never widen it) */
hr.kodza-separator:not(#_) {
border: 0;
background: var(--kz-separator-line);
transition: transform var(--kz-separator-duration) var(--kz-separator-ease);
}
.kodza-separator.is-resetting:where(hr):not(#_) {
transition: none;
}
@media (prefers-reduced-motion: reduce) {
.kodza-separator:where(hr):not(#_) {
transition: none !important;
}
}
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Separator
// Draws each line when it comes into view (verticals in a row one after the other), and again
// on "kodza:replay".
(() => {
const SELECTOR = '.kodza-separator';
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const draw = (el) => {
el.classList.add('is-resetting');
el.classList.remove('is-drawn');
void el.offsetWidth;
el.classList.remove('is-resetting');
// Verticals in a row: one after the other
const row = el.closest('.kodza-separator-row');
const index = row ? [...row.querySelectorAll('.kodza-separator')].indexOf(el) : 0;
el.style.transitionDelay = row ? `${index * 90}ms` : '';
el.classList.add('is-drawn');
};
// One instance. Everything it starts is tied to `signal`, so kodza:destroy stops it all
function mount(el, signal) {
el.addEventListener('kodza:replay', () => draw(el), { signal });
if (!('IntersectionObserver' in window) || reduceMotion) return el.classList.add('is-drawn');
const io = new IntersectionObserver(([entry]) => {
if (!entry.isIntersecting) return;
io.disconnect();
draw(entry.target);
}, { threshold: 0, rootMargin: '0px 0px -12% 0px' });
io.observe(el);
signal.addEventListener('abort', () => io.disconnect());
}
// Kodza lifecycle, the same in every component: `kodza:init` starts the instances inside
// event.detail.root (the whole page by default), `kodza:destroy` stops them and puts their
// markup back. For themes and apps that swap content without a page load.
const instances = new WeakMap();
const find = (scope = document) => [scope, ...scope.querySelectorAll(SELECTOR)].filter((el) => el.matches?.(SELECTOR));
const init = (scope) => find(scope).forEach((root) => {
if (root.classList.contains('is-ready')) return; // already running, maybe from another copy of this script
const controller = new AbortController();
instances.set(root, { controller, html: root.innerHTML, attrs: [...root.attributes].map((a) => [a.name, a.value]) });
mount(root, controller.signal);
root.classList.add('is-ready');
});
const destroy = (scope) => find(scope).forEach((root) => {
const instance = instances.get(root);
if (!instance) return;
instances.delete(root);
instance.controller.abort();
[...root.attributes].forEach((a) => root.removeAttribute(a.name));
instance.attrs.forEach(([name, value]) => root.setAttribute(name, value));
root.innerHTML = instance.html;
});
document.addEventListener('kodza:init', (event) => init(event.detail?.root));
document.addEventListener('kodza:destroy', (event) => destroy(event.detail?.root));
init();
// Loaded in <head>, the script runs before the markup exists: once more when it is parsed
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => init(), { once: true });
})();
'use client';
// Kodza — Separator, for React. From https://kodza.dev/components/separator/
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Next to this file: separator.css and separator.js, the component's CSS and JS from Kodza, as they are.
// Yours to edit: the markup is plain JSX below.
// The script changes this markup once React has rendered it (it adds layers, splits text, moves
// nodes), so React must not patch it afterwards. When a prop changes, the key gives React a fresh
// element: kodza:destroy stops the script on the old one, kodza:init starts it on the new one.
import { useRef, useEffect, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './separator.css';
type Variant = "dot" | "label" | "start" | "vertical";
export type SeparatorProps = Omit<ComponentPropsWithoutRef<'div'>, "children" | "variant" | "vars"> & {
/** Modifier class(es): .kodza-separator--dot, .kodza-separator--label, .kodza-separator--start, .kodza-separator--vertical */
variant?: Variant | Variant[];
/** Settings, as CSS variables on the root */
vars?: {
/** default: rgba(10, 10, 10, 0.16) */
"--kz-separator-line"?: string | number;
/** default: #0a0a0a */
"--kz-separator-fg"?: string | number;
/** default: rgba(10, 10, 10, 0.6) */
"--kz-separator-muted"?: string | number;
/** default: cubic-bezier(0.65, 0, 0.35, 1) */
"--kz-separator-ease"?: string | number;
/** default: 0.9s */
"--kz-separator-duration"?: string | number;
};
/** The text, plain: the script reads it and rebuilds the markup around it */
children?: string;
className?: string;
};
export function Separator({ variant, vars, children = "02 — Install", className, style, ...rest }: SeparatorProps) {
const ref = useRef<ComponentRef<'div'>>(null);
const classes = ["kodza-separator", "kodza-separator--label", "kodza-separator--start", ...([] as string[]).concat(variant ?? []).map((v) => `kodza-separator--${v}`), className].filter(Boolean).join(' ');
// Everything the markup is made of: when it changes, React gets a fresh element (see the top)
const key = JSON.stringify([classes, vars, children, style, rest]);
// Starts the script on this element once React has rendered it, stops it when it goes
useEffect(() => {
const root = ref.current;
let live = true;
// @ts-ignore: a plain script, no types to find
import('./separator.js').then(() => {
if (live) document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root } }));
});
return () => {
live = false;
document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } }));
};
}, [key]);
return (
<div role="separator" key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
<span>{children}</span>
</div>
);
}
Checked
Robots poked at it before you did. Every component goes through the same checks, and again each time it changes.