Share Button
Press Share and the options slide out from behind it, the last one pushing the pill open, while the arrow takes off and a cross draws itself. Copy link turns into a check; X and LinkedIn open in a small window.
View codeA button whose label rolls up letter by letter on hover, and keeps rolling the same way when you leave. Plain CSS and a few lines of JS.
With your AI
Say it to your AI. It gets the exact code below, not its best guess, and knows where it goes.
Use the Kodza Roll Button for my newsletter Subscribe.
claude mcp add -t http kodza https://kodza.dev/api/mcp
<a class="kodza-roll-button" href="#">
<span class="kodza-roll-button__label">Let's ship it</span>
</a>
<a class="kodza-roll-button kodza-roll-button--ghost" href="#">
<span class="kodza-roll-button__label">Skip the setup</span>
</a>
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Roll Button
Every letter of the label rolls up and is replaced by its copy, one after the other.
On the way out the wave keeps going in the same direction instead of rewinding.
Everything is tuned with the --kz-roll-* variables. */
.kodza-roll-button {
--kz-roll-bg: #0a0a0a;
--kz-roll-fg: #ffffff;
--kz-roll-border: transparent;
--kz-roll-height: 52px;
--kz-roll-pad-x: 28px;
--kz-roll-radius: 999px;
--kz-roll-duration: 0.55s;
--kz-roll-stagger: 16ms;
--kz-roll-ease: cubic-bezier(0.76, 0, 0.24, 1);
display: inline-flex;
align-items: center;
justify-content: center;
height: var(--kz-roll-height);
padding: 0 var(--kz-roll-pad-x);
border: 0;
border-radius: var(--kz-roll-radius);
background: var(--kz-roll-bg);
box-shadow: inset 0 0 0 1.5px var(--kz-roll-border);
color: var(--kz-roll-fg);
font: inherit;
font-weight: 500;
letter-spacing: -0.01em;
text-decoration: none;
white-space: nowrap;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.kodza-roll-button:active {
transform: scale(0.97);
}
.kodza-roll-button:focus-visible {
outline: 2px solid var(--kz-roll-bg);
outline-offset: 3px;
}
.kodza-roll-button--ghost {
--kz-roll-bg: transparent;
--kz-roll-fg: #0a0a0a;
--kz-roll-border: rgba(10, 10, 10, 0.9);
}
.kodza-roll-button--ghost:focus-visible {
outline-color: var(--kz-roll-fg);
}
/* The letters are clipped by the label: each one leaves through the top while its copy comes in */
.kodza-roll-button__label {
display: inline-flex;
overflow: hidden;
padding-block: 0.1em;
line-height: 1.25;
}
.kodza-roll-button__letter {
position: relative;
display: inline-block;
white-space: pre;
transition: transform var(--kz-roll-duration) var(--kz-roll-ease);
/* Leaving: the last letters go first, so the wave carries on */
transition-delay: calc(var(--r, 0) * var(--kz-roll-stagger));
}
.kodza-roll-button__letter::after {
content: attr(data-char);
position: absolute;
top: calc(100% + 0.1em);
left: 0;
}
.kodza-roll-button:hover .kodza-roll-button__letter,
.kodza-roll-button:focus-visible .kodza-roll-button__letter {
transform: translateY(calc(-100% - 0.1em));
transition-delay: calc(var(--i, 0) * var(--kz-roll-stagger));
}
/* Read once, as a whole word, by screen readers */
.kodza-roll-button__sr {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
.kodza-roll-button,
.kodza-roll-button__letter {
transition-duration: 0.01ms;
transition-delay: 0s;
}
}
/* Theming example — on a dark background:
.dark-section .kodza-roll-button {
--kz-roll-bg: #ffffff;
--kz-roll-fg: #0a0a0a;
}
*/
/* kodza-guard 735bbfa3f72c — 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-roll-button):not(#_) {
outline: revert;
outline-offset: revert;
}
/* What the browser gives, on everything the component leaves to it */
.kodza-roll-button:not(#_) {
list-style: revert;
box-sizing: revert;
position: revert;
appearance: revert;
max-height: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
min-height: revert;
}
.kodza-roll-button__label:not(#_),
.kodza-roll-button__letter:not(#_),
.kodza-roll-button__sr:not(#_) {
box-sizing: revert;
}
.kodza-roll-button__letter: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) */
.kodza-roll-button:not(#_) {
display: inline-flex;
align-items: center;
justify-content: center;
height: var(--kz-roll-height);
padding: 0 var(--kz-roll-pad-x);
border: 0;
border-radius: var(--kz-roll-radius);
background: var(--kz-roll-bg);
box-shadow: inset 0 0 0 1.5px var(--kz-roll-border);
color: var(--kz-roll-fg);
font: inherit;
font-weight: 500;
letter-spacing: -0.01em;
text-decoration: none;
white-space: nowrap;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.kodza-roll-button:active:not(#_) {
transform: scale(0.97);
}
.kodza-roll-button:focus-visible:not(#_) {
outline: 2px solid var(--kz-roll-bg);
outline-offset: 3px;
}
.kodza-roll-button--ghost:focus-visible:not(#_) {
outline-color: var(--kz-roll-fg);
}
@media (prefers-reduced-motion: reduce) {
.kodza-roll-button:not(#_) {
transition-duration: 0.01ms;
transition-delay: 0s;
}
}
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Roll Button
// Splits each label into letters (each with its index, and its index from the end)
// and keeps a plain copy of the text for screen readers.
(() => {
const SELECTOR = '.kodza-roll-button';
// One instance. Everything it starts is tied to `signal`, so kodza:destroy stops it all
function mount(button, signal) {
const label = button.querySelector('.kodza-roll-button__label');
if (!label) return;
const text = label.textContent.trim();
const letters = [...text];
label.textContent = '';
label.setAttribute('aria-hidden', 'true');
letters.forEach((char, i) => {
const letter = document.createElement('span');
letter.className = 'kodza-roll-button__letter';
letter.textContent = char;
letter.dataset.char = char;
letter.style.setProperty('--i', i);
letter.style.setProperty('--r', letters.length - 1 - i);
label.append(letter);
});
const sr = document.createElement('span');
sr.className = 'kodza-roll-button__sr';
sr.textContent = text;
button.append(sr);
}
// 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 — Roll Button, for React. From https://kodza.dev/components/button-slide/
// 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: button-slide.css and button-slide.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 './button-slide.css';
type Variant = "ghost";
export type RollButtonProps = Omit<ComponentPropsWithoutRef<'a'>, "children" | "variant" | "vars"> & {
/** Modifier class(es): .kodza-roll-button--ghost */
variant?: Variant | Variant[];
/** Settings, as CSS variables on the root */
vars?: {
/** default: #0a0a0a */
"--kz-roll-bg"?: string | number;
/** default: #ffffff */
"--kz-roll-fg"?: string | number;
/** default: transparent */
"--kz-roll-border"?: string | number;
/** default: 52px */
"--kz-roll-height"?: string | number;
/** default: 28px */
"--kz-roll-pad-x"?: string | number;
/** default: 999px */
"--kz-roll-radius"?: string | number;
/** default: 0.55s */
"--kz-roll-duration"?: string | number;
/** default: 16ms */
"--kz-roll-stagger"?: string | number;
/** default: cubic-bezier(0.76, 0, 0.24, 1) */
"--kz-roll-ease"?: string | number;
};
/** The text, plain: the script reads it and rebuilds the markup around it */
children?: string;
className?: string;
};
export function RollButton({ variant, vars, children = "Let's ship it", className, style, ...rest }: RollButtonProps) {
const ref = useRef<ComponentRef<'a'>>(null);
const classes = ["kodza-roll-button", ...([] as string[]).concat(variant ?? []).map((v) => `kodza-roll-button--${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('./button-slide.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 (
<a href="#" key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
<span className="kodza-roll-button__label">{children}</span>
</a>
);
}
Checked
Robots poked at it before you did. Every component goes through the same checks, and again each time it changes.