Ticket
A notched pass with a media panel, flexible content and a perforated seam.
Demo
Usage
import { Button, Gradient, Ticket } from '@tuttn/slant'
<Ticket
media={<Gradient variant="columns" running={false} style={{ height: '100%' }} />}
footer={<><span>SL / 024</span><Button onClick={save}>Save ticket</Button></>}
>
<h3>Field notes</h3>
<p>A small space for the ideas worth another look.</p>
</Ticket>
// An image can carry the visual. Give it useful alt text, or alt="" if decorative.
<Ticket media={<img src="/project.webp" alt="A notebook open on a desk" />}>
<h3>Notes from the studio</h3>
<a href="/projects/notes">Read the project</a>
</Ticket>
// The footer accepts your own code, barcode image or metadata.
<Ticket footer={<img src="/ticket-code.svg" alt="Ticket SL024 barcode" />}>
<h3>Studio visit</h3>
</Ticket>Props
| Prop | Type | Default | Description |
|---|---|---|---|
media | ReactNode | — | The visual at the inline start. It moves above the content in narrow containers. |
footer | ReactNode | — | An optional row below the content, for a code, metadata, barcode or actions. |
…rest | HTMLAttributes<HTMLDivElement> | — | Native attributes, className, style and the ref reach the outer container. Children fill the main panel. |
Accessibility
- The outer div adds no role, tab stop or click action. Its children remain live and readable.
- Use real buttons or links for actions and meaningful alt text for informative media.
- The ticket adds no automatic motion.
A seam between two panels
The visual takes one third of the width and the content takes the rest. A perforated seam and circular cutouts separate them. The cutouts are transparent masks, so they reveal the real background beneath the ticket, including images and gradients. With no media, the ticket is a single panel without a seam.
Small spaces
Below 480px of available width, the visual moves above the content and the cutouts move to the horizontal join. This follows the ticket's container, including a narrow column on a wide screen. Text wraps and the footer can break onto a second row.
Composition
Use media for an image, a still gradient or your own artwork, and footer for actions or metadata. A barcode belongs in that slot when needed; Ticket does not invent a scannable code. Keep meaningful alt text on a supplied barcode image and the code in readable text nearby.
Accessibility
The ticket is a plain container with no forced role or click behaviour. Give its content a real heading and use native links or buttons for actions. Only the paper shape is decorative; the media and content keep the semantics you supply.