# Visual

Illustrates the top of an onboarding or feature modal.

[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Visual.tsx)

Figma: [Content/Visual](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-2662)

## Overview

A visual is a 208px illustrated panel that sits above a centered modal title. `kind` selects the artwork, and `passkey` is the only kind today.

## Examples

### Basic

Set `kind` to `passkey` (default). The panel fills its container, and the artwork stays 374px wide and centered.

```tsx
import { style, Visual } from '@tempoxyz/ds'

export function Demo() {
  return (
    <div {...styles.frame()}>
      <Visual kind="passkey" />
    </div>
  )
}

namespace styles {
  export const frame = style({ maxWidth: '24rem !custom', width: '100% !custom' })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Visual/Basic.tsx)

### Chip

Add `Visual.Chip` for a short instruction. It sits 24px from the top and 12px from the end.

```tsx
import { style, Visual } from '@tempoxyz/ds'

export function Demo() {
  return (
    <div {...styles.frame()}>
      <Visual kind="passkey">
        <Visual.Chip>Touch to sign in</Visual.Chip>
      </Visual>
    </div>
  )
}

namespace styles {
  export const frame = style({ maxWidth: '24rem !custom', width: '100% !custom' })
}
```

[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Visual/Chip.tsx)

## Anatomy

Import the component and assemble its parts.

```tsx
import { Visual } from '@tempoxyz/ds'

<Visual>
  <Visual.Chip />
</Visual>
```

## Guidelines

### When to Use

* Open an onboarding or feature modal, such as adding a passkey, above a centered title.

### When Not to Use

* Use [IconTile](/docs/components/icon-tile) for acknowledgment, success, and destructive confirmation modals.
* Use a [Dialog](/docs/components/dialog) without a visual for form and review modals.

### Use One Visual Above the Title

**Do:** Place one visual above a centered title.

```tsx
/**
 * Do example for "Use One Visual Above the Title" on the Visual page.
 * Place one visual above a centered title.
 * @module
 */
import { style, Visual } from '@tempoxyz/ds'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.stack()}>
      <Visual kind="passkey" />
      <span {...styles.title()}>Add a passkey</span>
      <span {...styles.description()}>Sign in with your fingerprint or face.</span>
    </div>
  )
}

namespace styles {
  export const description = style({ color: 'content.secondary', typography: 'body.b2' })

  export const stack = style({
    alignItems: 'center',
    display: 'flex',
    flexDirection: 'column',
    gap: '8',
    maxWidth: '24rem !custom',
    textAlign: 'center',
    width: '100% !custom',
  })

  export const title = style({
    color: 'content.primary',
    marginBlockStart: '16',
    typography: 'heading.h4',
  })
}
```

**Don't:** Stack a visual and an [IconTile](/docs/components/icon-tile).

```tsx
/**
 * Don't example for "Use One Visual Above the Title" on the Visual page.
 * Don't stack a visual and an icon chip.
 * @module
 */
import { IconTile, style, Visual } from '@tempoxyz/ds'
import { Passkey } from '@tempoxyz/ds/icons'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.stack()}>
      <IconTile>
        <Passkey />
      </IconTile>
      <Visual kind="passkey" />
      <span {...styles.title()}>Add a passkey</span>
    </div>
  )
}

namespace styles {
  export const stack = style({
    alignItems: 'center',
    display: 'flex',
    flexDirection: 'column',
    gap: '16',
    maxWidth: '24rem !custom',
    textAlign: 'center',
    width: '100% !custom',
  })

  export const title = style({ color: 'content.primary', typography: 'heading.h4' })
}
```

### Keep the Chip to a Few Words

The chip stays on one line, so a long label runs past the panel edge.

**Do:** Write one short instruction in the chip.

```tsx
/**
 * Do example for "Keep the Chip to a Few Words" on the Visual page.
 * Write one short instruction in the chip.
 * @module
 */
import { style, Visual } from '@tempoxyz/ds'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.frame()}>
      <Visual kind="passkey">
        <Visual.Chip>Touch to sign in</Visual.Chip>
      </Visual>
    </div>
  )
}

namespace styles {
  export const frame = style({ maxWidth: '24rem !custom', width: '100% !custom' })
}
```

**Don't:** Write a sentence in the chip.

```tsx
/**
 * Don't example for "Keep the Chip to a Few Words" on the Visual page.
 * Don't write a sentence in the chip.
 * @module
 */
import { style, Visual } from '@tempoxyz/ds'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.frame()}>
      <Visual kind="passkey">
        <Visual.Chip>Place your finger on the sensor to finish signing in</Visual.Chip>
      </Visual>
    </div>
  )
}

namespace styles {
  export const frame = style({ maxWidth: '24rem !custom', width: '100% !custom' })
}
```

## Content

* **Chip:** Write an instruction of two to four words in sentence case, such as Touch to sign in, with no end punctuation.

## Accessibility

A visual renders a `<div>` with no role and takes no focus. Screen readers skip the artwork and read the chip text in place.

### Semantics

* **Artwork (aria-hidden):** Decorative, so screen readers skip it.
* **Visual.Chip (span):** Plain text, read in place. The dot is hidden.

### Your Responsibilities

* **Name the Feature in the Title:** The artwork has no text alternative, so the modal title names the feature.
* **Label a Meaningful Visual (aria-label):** If the visual carries meaning alone, set `role="img"` and an `aria-label`.

## Related

[IconTile](/docs/components/icon-tile)

Use for icons at the top of other centered modals.

[Dialog](/docs/components/dialog)

Use for the modal that holds the visual.
