# Svelte adapter `@myrialabs/ptykit/svelte` wraps `@myrialabs/ptykit/client` + xterm.js + FitAddon into one configurable, SSR-safe component. ```svelte ``` A richer example: ```svelte (client = c)} onexit={(code) => console.log('shell exited', code)} onstatus={(s) => console.log('status', s)} /> ``` ## Props | Prop | Type | Default | Notes | |---|---|---|---| | `sessionId` | `string` | — | Session to attach to / create. | | `url` | `string` | — | WebSocket endpoint. | | `namespace` | `string?` | — | Room/namespace; required with `create`. | | `create` | `boolean` | `false` | Create instead of attach. | | `client` | `PtyKitClient?` | — | Reuse an existing client instead of creating one. | | `reconnect` | `ReconnectOptions?` | — | Reconnect tuning for the internal client. | | `persistence` | `SessionPersistence?` | — | sessionId persistence override. | | `requestTimeoutMs` | `number?` | — | RPC timeout. | | `cols` / `rows` / `cwd` / `shell` | — | — | Session params used when creating. | | `scrollback` | `number` | `5000` | Terminal scrollback lines. | | `fontSize` / `fontFamily` / `lineHeight` | — | — | Terminal typography. | | `cursorBlink` | `boolean` | `true` | | | `cursorStyle` | `'block' \| 'underline' \| 'bar'` | `'block'` | | | `theme` | `ITheme?` | — | xterm theme object. | | `terminalOptions` | `object?` | `{}` | Extra/override xterm options. | | `fit` | `boolean` | `true` | Attach FitAddon + ResizeObserver. | | `fitDebounceMs` | `number` | `100` | | | `showStatus` | `boolean` | `true` | Built-in status chip. | | `class` | `string?` | — | Extra class on the root element. | ## Events (callback props) | Prop | Fires with | |---|---| | `onready` | `{ client, session, terminal }` once attached. | | `ondata` | each output chunk written to the terminal. | | `onexit` | the exit code when the shell exits. | | `onstatus` | `'connected' \| 'reconnecting' \| 'disconnected'`. | | `onerror` | a connection or server error. | | `ondirectory` | the new working directory. | ## Peer dependencies Requires `svelte`, `@xterm/xterm`, and `@xterm/addon-fit` in the consuming app (declared as optional peer dependencies of `ptykit`). React/Vue adapters are community extension points; the contract is the same `@myrialabs/ptykit/client` surface in [client.md](./client.md).