# Ticket (ticket)

> Admission-style surface with a colored header, flexible body, and perforated footer stub.

- Entry: component
- Category: UI
- Preview capabilities: controls
- Runtime: React
- Needs Remotion: no
- QA page: https://jbm-ui.bns.studio/c/ticket
- JSON: https://jbm-ui.bns.studio/catalog/ticket.json
- Registry item: https://jbm-ui.bns.studio/r/ticket.json (source code in files[].content)

## Install

```sh
npx shadcn@latest add @jbm/ticket
```

Also installs @jbm/tokens (registry dependencies install automatically).

## Required setup

1. Add the `@jbm` registry to components.json (keep any entries already there):

   ```json
   {
     "registries": {
       "@jbm": "https://jbm-ui.bns.studio/r/{name}.json"
     }
   }
   ```

2. Map `@/*` to `./src/*` in tsconfig.json `compilerOptions.paths`, so `@/jbm/…` imports resolve to src/jbm/.

## Files

Each file's source code is in the registry item JSON (https://jbm-ui.bns.studio/r/ticket.json, files[].content).

| Source path | Installs to | Import |
| --- | --- | --- |
| `registry/jbm/ui/ticket.tsx` | `src/jbm/ui/ticket.tsx` | `@/jbm/ui/ticket` |

## API

### `Ticket` (component)

A card-stock surface (shared card border, shadow, and radius tokens) with an optional ink or vermilion mono header band, a 24px-padded body for arbitrary children, and an optional stub below a dashed perforation line. Content semantics belong to the caller; div attributes pass through.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `header` | `React.ReactNode` | none | Optional header band content (12px mono, cream text). Omit (null/undefined) to hide the band. |
| `stub` | `React.ReactNode` | none | Optional footer stub content (12px dim mono) below a dashed line. Omit to hide. |
| `tone` | `"ink" \| "accent"` | `"ink"` | Header band fill: "ink" or the vermilion "accent". |

Also accepts React.HTMLAttributes<HTMLDivElement>.

## Stage

fluid: Width fills the container; height follows content: header band (14px padding × 2 + one 12px mono line), body (24px padding × 2 + children), and stub (16px padding × 2 + 12px × 1.5 lines), plus the card border. Set style.width for a fixed ticket.

## Examples

### Admission ticket

```tsx
import { Ticket } from "@/jbm/ui/ticket"

<Ticket header="ADMIT ONE · OCT 2026" stub="Tu nombre · Tu comunidad" tone="accent">
  <h3>Un lugar para crear.</h3>
  <p>Trae tu curiosidad.</p>
</Ticket>
```

### Work order with the same slots

```tsx
import { Ticket } from "@/jbm/ui/ticket"

<Ticket header="orden de trabajo" stub={<>Hecho es:<br />Las pruebas pasan.</>}>
  <h3>Migrar los pagos</h3>
  <p>Del cliente anterior al nuevo.</p>
</Ticket>
```

## QA

- Toggle the Vermilion header control: the band switches between accent and ink while body and stub are unchanged.
- Check the rounded corners clip the header band and the dashed perforation spans the full width above the stub.
- Remove header or stub and confirm no empty band or dashed line remains.
- Check long content on a narrow screen wraps inside the ticket (overflowWrap anywhere) and the surface border and shadow match Card.

## Docs

- [Visual primitives guide](https://jbm-ui.bns.studio/docs/visual-primitives.md)

## Related

Installs:

- [Tokens (tokens)](https://jbm-ui.bns.studio/catalog/tokens.md)

## More

- [llms.txt](https://jbm-ui.bns.studio/llms.txt): index of every item
- [catalog.json](https://jbm-ui.bns.studio/catalog.json): every item as JSON
- [Agent contract](https://jbm-ui.bns.studio/docs/agent-contract.md): what each field means
