# GeneratedUI

Screens a model describes, such as forms, charts, tables, lists and steps, checked before they render.

- **Use it for**: Showing a screen a model described, once it has been checked.
- **Not for**: Interfaces you write yourself. Try [AIForm](https://unseenui.com/components/ai-form/), [Chart](https://unseenui.com/components/chart/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { GeneratedUI } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<GeneratedUI variant="stack" surface={surface} state="ready" onAction={requestAction} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `actionPresentations` | `readonly GeneratedActionPresentation[]` | Trusted, version-bound host emphasis. |
| `actionStates` | `readonly GeneratedActionSnapshot[]` |  |
| `className` | `string` | Added to the root element, after the component's own classes. |
| `error` | `string` |  |
| `forms` | `Record<string, GeneratedFormSnapshot>` |  |
| `imageOrigins` | `readonly string[]` | Origins (`https://images.example.com`) the host allows generated images to load from. |
| `onAction` | `((request: GeneratedActionRequest) => void)` |  |
| `onFormChange` | `((request: GeneratedFormRequest) => void)` |  |
| `problems` | `readonly { line: number; code: string; message: string; }[]` | Statements a streaming parser could not show; listed under the result, never hidden. |
| `state` (required) | `"pending" \| "ready" \| "loading" \| "denied" \| "unavailable" \| "error" \| "stale" \| "streaming"` |  |
| `surface` (required) | `unknown` |  |
| `variant` | `"cards" \| "compact" \| "stack"` |  |

## Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

## Works with

[AIForm](https://unseenui.com/components/ai-form/), [DataGrid](https://unseenui.com/components/data-grid/), [Chart](https://unseenui.com/components/chart/), [ClarificationRequest](https://unseenui.com/components/clarification-request/)

Page: https://unseenui.com/components/generated-ui/
