Skip to Content
zjkm-ui
Components

Animated Checkbox

A checkbox whose tick draws itself.

Props
<AnimatedCheckbox>
  Email me about new components
</AnimatedCheckbox>

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/animated-checkbox.json
import { AnimatedCheckbox } from "@/components/animated-checkbox"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

A native checkbox drawn as a rounded box whose tick draws itself when checked. The real input stays in the page, so forms, labels and keyboard work as usual.

import { AnimatedCheckbox } from "@/components/animated-checkbox";

export function Terms() {
  return <AnimatedCheckbox name="terms" required>I agree to the terms</AnimatedCheckbox>;
}

Props

PropTypeDefaultDescription
childrenReactNodeThe label.
colorstring"#6366f1"Box colour when checked.
classNamestringClasses for the wrapper.
...propsinput propsEvery native checkbox prop: name, checked, onChange and so on.

With reduced motion, the tick appears without drawing.

On this page