Components
Terminal
A quiet console: the transcript above, the prompt line below. The component owns only the reading and the caret — each entered line leaves as an event, and the caller answers through the lines prop, so history stays theirs to shape.
#Basic usage
paper 0.1.0
Type help to see what the console knows.
<script setup lang="ts">
import { Terminal } from "@bysages/vue";
import { ref } from "vue";
const lines = ref(["paper 0.1.0", "Type help to see what the console knows."]);
function run(text: string) {
if (text === "clear") {
lines.value = [];
return;
}
lines.value.push(`❯ ${text}`);
lines.value.push(text === "help" ? "Commands: help, clear" : `unknown command: ${text}`);
}
</script>
<template>
<Terminal
:lines="lines"
prompt="❯"
placeholder="Type a command…"
label="Paper console"
class="w-full max-w-xl"
@command="run"
/>
</template>
#Props
#Terminal
A quiet console: the transcript above, the prompt line below. The component owns only the reading and the caret — each entered line leaves as an event, and the caller answers through the lines prop, so history stays theirs to shape.
| Prop | Type | Default | Description |
|---|---|---|---|
lines | Array as PropType<string[]> | () => [] | The transcript, oldest line first. |
prompt | String | "$" | The sigil at the head of the entry line. |
placeholder | String | undefined | — |
label | String | undefined | — |