# Strikethrough {#strikethrough}

Source: [Add strikethrough to a React editor · Yurich](https://leeyujoo.com/yurich/features/strikethrough/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

Cross out text while keeping it visible.

## Try it {#try-it}

Select “Yurich” and click **Strikethrough**. The crossed-out word appears as `<s>Yurich</s>` in HTML. The text stays in the document.

## Add it to your editor {#setup}

Enable `Strikethrough` when a user needs to mark selected text as crossed out. Use `toggleStrikethrough` for the button.

```tsx
import { EditorContent, EditorProvider, Strikethrough, useEditor, useIsActive } from 'yurich';

export function StrikethroughEditor() {
  const editor = useEditor({
    extensions: [Strikethrough],
    initialValue: "<p>Strike Yurich from this sentence and see what survives.</p>",
  });
  const active = useIsActive(editor, 'toggleStrikethrough');

  return (
    <EditorProvider editor={editor}>
      <button
        type="button"
        aria-pressed={active}
        onMouseDown={event => event.preventDefault()}
        onClick={() => editor.execute('toggleStrikethrough')}
      >
        Strikethrough
      </button>
      <EditorContent ariaLabel="Editor" />
    </EditorProvider>
  );
}
```

## Behavior to account for {#behavior}

The shortcut is `Mod+Shift+S`. HTML loaded with `<del>` is normalized to `<s>`.

[Features](https://leeyujoo.com/yurich/features/)
