Components

Strike

A red pencil through real words: one line, two lines, or a cross-out. The text stays readable and real underneath, so a price that was 49 can still be copied and read by a screen reader.

Install

terminal
npx shadcn@latest add @wobko/strike

First time here? Add the registry to components.json first. How to install

Examples

Default

Red pencil through the old plan. The line tilts a little and pokes out past both ends.

Kinds and pens

A single line, a double line, a cross-out over the whole phrase, and other pens.

A price that dropped

The old price stays in the text (and in the accessibility tree as <s>), so nothing is lost to a screen reader; the card says what changed.

A to-do list

Tick a box and the task is struck through in red pencil, drawn on as you tick it.

API reference

Strike

A <s> (or your own element with asChild) that hosts the drawing, in front of the words. One line per line of the phrase; a cross-out is one X over the whole phrase.

PropTypeDefaultDescription
kind"single" | "double" | "cross""single"One line, two lines, or two long diagonals across the phrase.
tone"red" | "ink" | "blue" | "green" | "pencil" | "marker" | "orange""red"The pen. Red is a waxy colored pencil.
weight"fine" | "regular" | "brush""regular"Fine-liner, regular or brush.
animatebooleanfalseDraw the line on the first time it scrolls into view.
showbooleantrueShow or hide the line. With animate, turning it on plays the draw-on.
delaynumber-Milliseconds to wait before drawing on.
seedstring | number-Pins the hand.
asChildbooleanfalseRender the line on your own child element.

Accessibility

  • A real <s> element, which browsers and many screen readers treat as content that is no longer accurate. Say what changed in the surrounding text ("was", "now") rather than relying on the line alone.
  • When the line is only decoration (a ticked-off task whose state a checkbox already announces) use `asChild` on a <span>, so the words are not marked as deleted for everyone, and `show` for the on and off states; with `show={false}` the native line-through is hidden too.
  • The text underneath stays selectable and copyable; the drawing is aria-hidden and pointer-events-none.
  • Before the drawing exists and in Windows high contrast the browser's own line-through is shown.

Source

The files the CLI copies into your project.

Loading the source