# Car display

A car's wide centre screen in a flat dash: a dock on the driver's side, tiles for the route, media and answers, and a voice bar that rises with the orb and one line of transcript.

Example: A charger on the way. The driver asks for a charger; the voice bar rises, the answer replaces the music, and the stop lands on the route. Loops. Preview: https://chatcn.dev/preview/car-display-demo

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/car-display.json
```

## Usage

```tsx
import {
  CarAction,
  CarDisplay,
  CarDock,
  CarGrid,
  CarMap,
  CarTile,
  CarVoiceBar,
} from "@/components/ui/chatcn/car-display"

<CarDisplay context>
  <CarDock active={["navigation", "assistant"]} time="6:12" temperature="48 °F" />
  <CarGrid>
    <CarTile place="main">
      <CarMap
        maneuver={{ distance: "0.4 mi", road: "Turn right onto Marsh Lane" }}
        eta={{ arrival: "6:40 PM", duration: "1 h 14 min", distance: "61 mi" }}
        stops={[{ id: "charger", at: 0.72, label: "Fast charger" }]}
      />
    </CarTile>
    <CarTile place="side" hidden={answered}>{/* now playing */}</CarTile>
    <CarTile place="side" hidden={!answered}>
      {/* the answer */}
      <CarAction variant="primary">Add stop</CarAction>
    </CarTile>
  </CarGrid>
  <CarVoiceBar state="listening" level={getMicLevel} transcript="Find a charger on the way to Portland" />
</CarDisplay>
```

The screen lays out at a true 1920 by 720 viewport (8:3, the long dashboard screen) or 1200 by 1600 with `screen="portrait"`, and scales to fit. It stands in a flat dash with the faintest reflection of its lower edge. `context` adds the top of a steering wheel rim in the foreground, out of focus, on the driver's side: it never reaches the dock or the orb.

Everything inside is car sized: app buttons and actions are 76 px or more in the viewport. That is why car screens look big: a driver reaches them at arm's length, at a glance, on a moving road. Under a 1280 px viewport (960 in portrait) the screen switches to a compact set with fewer details and larger type for its size, so a small embed stays readable.

The screen wears the night look, the `dark` class, unless `screenClassName` names `light` or `dark`. Cars dim at night, and the night look is the one people picture. The map is drawn from the theme: a turned street grid, a river and a park in faint tints, and the route in the theme's blue with a casing. There are no map tiles and no provider; pass `stops` to drop markers on the route.

`CarVoiceBar` floats over the bottom of the tiles. It rises 24 px when `state` leaves `idle` and falls when it returns. Its one line shows what was heard while listening and what is said while speaking, and fades at its end when it runs long. While thinking, the words stay for 300 ms and then give way to the Thinking shimmer. Pass `core` to put another presence in place of the voice orb. Buttons under the bar stay in the tab order, so leave room for it at the bottom of a tile (as the answer tile does) or make what it covers `inert` while it is up (as the music tile does). Two tiles may share a `place`: the hidden one fades out with a 2 px blur as the other fades in, in the same box, so an answer replaces the music without moving anything. In right to left layouts the dock and the wheel move to the other side.

## Examples

### States

A portrait screen, the steering wheel, listening, answering, the day look and a 390 px embed.

Example: Car display states. A portrait screen, the steering wheel, listening, answering, the day look and a 390 px embed. Preview: https://chatcn.dev/preview/car-display-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `screen` | `"wide" | "portrait"` | 1920 by 720 (default) or 1200 by 1600 |
| `context` | `boolean` | The steering wheel arc on the driver's side |
| `screenClassName` | `string` | Name `light` for the day look |
| `viewport`, `width`, `radius`, `safe` |  | From `FrameLite`; the bezel is always thin |
| `CarDock` | `items?`, `active?`, `onSelect?`, `time?`, `temperature?` | Five apps by default; `active` takes one id or several |
| `CarTile` | `place?`, `hidden?` | `main` or `side`; tiles in one place crossfade |
| `CarMap` | `maneuver?`, `eta?`, `stops?` | `stops` sit at 0 (the car) to 1 along the route |
| `CarVoiceBar` | `state`, `level`, `inputLevel`, `outputLevel`, `transcript`, `core`, `onStop` | Rises when `state` leaves `idle` |
| `CarAction` | `variant?`, `icon?` | A 76 px touch button for tiles |

Source: https://chatcn.dev/docs/components/car-display