# react-example-list-custom-checkbox

> Custom checkbox styling for task lists.

A shadcn/ui block from the [@prosekit](https://prosekit.dev) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/prosekit/react-example-list-custom-checkbox).

- Page, with a live preview: https://shadcn.exchange/r/prosekit/react-example-list-custom-checkbox
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/prosekit/react-example-list-custom-checkbox-light-ab8815f18fab8d8e.png
- Registry item: https://prosekit.dev/r/react-example-list-custom-checkbox.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://prosekit.dev/r/react-example-list-custom-checkbox.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `prosekit`
- Registry items: `https://unpkg.com/prosekit-registry/dist/r/react-sample-sample-doc-list-custom-checkbox.json`, `https://unpkg.com/prosekit-registry/dist/r/react-ui-toolbar.json`

## Files

### `registry/src/react/examples/list-custom-checkbox/custom-list.css`

```css
div[data-custom-list-css-enabled] .ProseMirror .prosemirror-flat-list[data-list-kind="task"] {
  & > .list-marker label {
    box-sizing: border-box;
    display: flex;
    position: relative;
    left: calc(var(--spacing) * -0.5);
    align-items: center;
    cursor: pointer;
    transition: transform 0.15s ease-in-out;

    &:hover {
      transform: scale(1.1);
    }

    &::after {
      position: absolute;
      width: calc(var(--spacing) * 5);
      height: calc(var(--spacing) * 5);
      content: "";
      color: var(--color-white);
      opacity: 0;
    }

    /* https://api.iconify.design/lucide.css?icons=check */
    &::after {
      display: inline-block;
      background-color: currentColor;
      -webkit-mask-image: var(--svg);
      mask-image: var(--svg);
      -webkit-mask-repeat: no-repeat;
      mask-repeat: no-repeat;
      -webkit-mask-size: 100% 100%;
      mask-size: 100% 100%;
      --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    }

    & input {
      box-sizing: border-box;
      appearance: none;
      width: calc(var(--spacing) * 5);
      height: calc(var(--spacing) * 5);
      margin: 0;
      border-width: 1px;
      border-style: solid;
      border-radius: var(--radius-md);
      border-color: color-mix(in srgb, var(--color-gray-300) 50%, transparent);
      box-shadow: var(--shadow-sm);
      cursor: pointer;
      transition: all 0.15s ease-in-out;

      &:hover {
        box-shadow: var(--shadow-md);
      }

      &:checked {
        border-color: var(--color-red-500);
        background-color: var(--color-red-500);
      }
    }
  }

  &[data-list-checked] > .list-marker label {
    &::after {
      opacity: 1;
    }
  }

  &[data-list-checked] {
    color: var(--color-gray-400);
    text-decoration: line-through;
    text-decoration-color: var(--color-gray-400);
  }
}
```

### `registry/src/react/examples/list-custom-checkbox/editor.tsx`

```tsx
'use client'

import 'prosekit/basic/style.css'
import 'prosekit/basic/typography.css'
import './custom-list.css'

import { createEditor, type NodeJSON } from 'prosekit/core'
import { ProseKit } from 'prosekit/react'
import { useMemo } from 'react'

import { sampleContent } from '../../sample/sample-doc-list-custom-checkbox.ts'
import { Toolbar } from '../../ui/toolbar/index.ts'

import { defineExtension } from './extension.ts'

interface EditorProps {
  initialContent?: NodeJSON
}

export default function Editor(props: EditorProps) {
  const defaultContent = props.initialContent ?? sampleContent
  const editor = useMemo(() => {
    const extension = defineExtension()
    return createEditor({
      extension,
      defaultContent,
    })
  }, [defaultContent])

  return (
    <ProseKit editor={editor}>
      <div className="box-border h-full w-full min-h-36 overflow-y-hidden overflow-x-hidden rounded-md border border-solid border-gray-200 dark:border-gray-700 shadow-sm flex flex-col bg-[canvas] text-black dark:text-white" data-custom-list-css-enabled>
        <Toolbar />
        <div className="relative w-full flex-1 box-border overflow-y-auto">
          <div ref={editor.mount} className="ProseMirror box-border min-h-full px-[max(4rem,calc(50%-20rem))] py-8 outline-hidden outline-0 [&_span[data-mention=user]]:text-blue-500 [&_span[data-mention=tag]]:text-violet-500"></div>
        </div>
      </div>
    </ProseKit>
  )
}
```

### `registry/src/react/examples/list-custom-checkbox/extension.ts`

```ts
import { defineBasicExtension } from 'prosekit/basic'
import { union } from 'prosekit/core'

export function defineExtension() {
  return union(defineBasicExtension())
}

export type EditorExtension = ReturnType<typeof defineExtension>
```

### `registry/src/react/examples/list-custom-checkbox/index.ts`

```ts
export { default as ExampleEditor } from './editor.tsx'
```
