Skip to content
caliper ui docs

Pro

Ticket tear

A ticket with a perforated stub. Drag the stub away and it peels about its lower corner; let go past halfway and it tears off and falls, and the ticket settles with a small recoil.

Pro
pnpm dlx shadcn@latest add @caliper/ticket-tear

Tonight

Drag the stub away, or press it.

Admit one

Harbour Lights

Fri 14 Nov · Pier 9 · Doors 19:30

Tear the stub off at the door.

Installs components/ui/ticket-tear.tsxDepends on none beyond ReactMotion honours reduced motion

When to use

Use it for

  • Event, travel and cinema tickets, and check-in moments.
  • Coupons and vouchers that are used up.

Skip it when

  • Tickets that must be scanned; keep the code visible and add a real scan state.
  • Anything the person might tear by accident; confirm first.

Decisions

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

Halfway decides
Past halfway it tears; short of that it springs back, so a tentative pull is safe.

Styling

Notches cut from the shape
The notches are masks, not painted circles, so they work on any background, and the hairline follows them.

Usage

A button as well as a drag
Enter or Space tears the stub, and the button says which seat it is.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/ticket-tear

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { TicketTear } from "@/components/ui/ticket-tear"

The worked example comes with Pro

The 30-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

TicketTear

component

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
title *string—The event or trip, shown large.
detailstring—Date, place and so on, under the title.
seat *string—The seat or entry shown on the stub.
onTear(() => void)—Called once when the stub comes away.
tearLabelstring"Tear off the stub"

Accessibility

It is built on native elements and keeps aria-label and aria-hidden in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.

All Surfaces examples