# swc-prompt-field

Prompt entry surface for AI flows. Uncontrolled with mirror pattern: the component updates its own draft state first, then emits events so consumers can mirror or override that state.

## Attributes

| Name                           | Type                                           | Default                                                                 | Description                                                                                                                                                                                           |
| ------------------------------ | ---------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `disabled`                     | `boolean`                                      | `false`                                                                 | Disables the textarea and all actions.                                                                                                                                                                |
| `generating`                   | `boolean`                                      | `false`                                                                 | Shows the stop button in place of send while a response is generating.                                                                                                                                |
| `variant`                      | `'subtle' \| 'balanced' \| 'prominent'`        | `'balanced'`                                                            | Visual intensity of the AI brand treatment.                                                                                                                                                           |
| `size`                         | `'s' \| 'm'`                                   | `'m'`                                                                   | Size of the prompt field.                                                                                                                                                                             |
| `loader`                       | `PixelLoaderIconName \| PixelLoaderPresetName` | `'aiLogo'`                                                              | Status loader artwork: a single icon name (static), or a preset name (`cc`, `dc`, `exp`, `analyze`, `mega`) that cycles a themed sequence. Routed to the loader's icon/preset in `_renderStatusIcon`. |
| `animate-loader`               | `boolean`                                      | `false`                                                                 | Animates the status loader while generating; otherwise it stays static. Has no visible effect unless `generating` is also `true`.                                                                     |
| `label`                        | `string`                                       | `'Prompt'`                                                              | Accessible name for the textarea; visually hidden.                                                                                                                                                    |
| `accessible-label`             | `string`                                       | `''`                                                                    | Optional accessible label override for the textarea.                                                                                                                                                  |
| `send-label`                   | `string`                                       | `'Send'`                                                                | Accessible label for the send action button.                                                                                                                                                          |
| `stop-label`                   | `string`                                       | `'Stop generating'`                                                     | Accessible label for the stop action button while generating.                                                                                                                                         |
| `upload-label`                 | `string`                                       | `'Add attachment'`                                                      | Accessible label for the upload button.                                                                                                                                                               |
| `attachment-scroll-prev-label` | `string`                                       | `'Show previous attachments'`                                           | Accessible label for the previous-attachment scroll button.                                                                                                                                           |
| `attachment-scroll-next-label` | `string`                                       | `'Show more attachments'`                                               | Accessible label for the next-attachment scroll button.                                                                                                                                               |
| `attachment-strip-label`       | `string`                                       | `'Uploaded assets strip'`                                               | Accessible name for the uploaded-attachments strip landmark.                                                                                                                                          |
| `placeholder`                  | `string`                                       | `'Ready to get started? Ask a question, share an idea, or add a task.'` | Placeholder text shown inside the textarea.                                                                                                                                                           |
| `value`                        | `string`                                       | `''`                                                                    | The current textarea value; internally updated and externally mirrorable.                                                                                                                             |
| `min-rows`                     | `number \| undefined`                          | -                                                                       | Minimum visible textarea rows before growth; unset relies on the natural single-line height.                                                                                                          |
| `max-rows`                     | `number \| undefined`                          | -                                                                       | Maximum visible textarea rows before internal scrolling; unset relies on max-block-size alone.                                                                                                        |

## Slots

| Name         | Description                                                                                                   |
| ------------ | ------------------------------------------------------------------------------------------------------------- |
| `attachment` | Optional attachment preview(s). Use one `swc-upload-attachment` type per session (cards only, or media only). |
| `legal`      | Legal disclaimer content. Required in product implementations; provide Legal-approved copy.                   |

## Events

| Name                            | Description                                                                                          |
| ------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `swc-prompt-field-input`        | Dispatched after the textarea value is internally updated. Detail: `{ value: string }`               |
| `swc-prompt-field-submit`       | Dispatched when send is triggered. Detail: `{ value: string }`                                       |
| `swc-prompt-field-stop`         | Dispatched when stop generation is requested while generating.                                       |
| `swc-prompt-field-upload-click` | Dispatched when upload affordance is activated. Consumers should handle file picker flow externally. |
| `swc-prompt-field-drop`         | Dispatched when files are dropped anywhere on the field. Detail: `{ files: File[] }`.                |

## CSS Custom Properties

| Name                                                  | Description                                                                                                                                                                                         |
| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--swc-prompt-field-brand-color`                      | Brand hue driving the AI treatment's ring, wash, and glow colors. Defaults to a fuchsia OKLCH value; only the hue is meaningfully used, lightness/chroma come from each layer's own derived values. |
| `--swc-prompt-field-max-block-size`                   | Maximum block size of the textarea before internal scrolling, combined with the `max-rows` attribute. Defaults to `40vh`.                                                                           |
| `--swc-prompt-field-attachment-card-inline-size`      | Inline size (and min/max) of `type="card"` attachment tiles. Defaults to 240px.                                                                                                                     |
| `--swc-prompt-field-attachment-media-inline-size`     | Inline size of `type="media"` attachment tiles. Defaults to 68px.                                                                                                                                   |
| `--swc-prompt-field-attachment-media-min-inline-size` | Minimum inline size of `type="media"` attachment tiles. Defaults to 68px.                                                                                                                           |
| `--swc-prompt-field-attachment-media-block-size`      | Block size of `type="media"` attachment tiles. Defaults to 68px.                                                                                                                                    |
| `--swc-prompt-field-attachment-media-min-block-size`  | Minimum block size of `type="media"` attachment tiles. Defaults to 68px.                                                                                                                            |
