A fully customizable static terminal component for vue.js
Visit the wiki for more examples.
First add it to your package.json
:
npm install vue-static-terminal --save
# or yarn
yarn add vue-static-terminal
Then import the component js:
import VueStaticTerminal from 'vue-static-terminal'
And the styles. Alternatively copy the styles to your project and customize them.
import 'vue-static-terminal/dist/vue-static-terminal.css'
If you don't use npm you can download the minified version in dist/vue-static-terminal.min.js
and the css in dist/vue-static-terminal.css
, then add it to your site:
<link rel="stylesheet" href="vue-static-terminal.css">
<script src="vue-static-terminal.min.js"></script>
Loading the minified version will automatically register the component VueStaticTerminal
globally on the browsers window
object.
Load the component:
Vue.use(VueStaticTerminal)
Use the component:
<static-terminal></vue-static-terminal>
export default {}
<static-terminal :header="terminal.header"
:prompt="terminal.prompt"
:commands="terminal.commands"></vue-static-terminal>
export default {
data: () => {
return {
terminal: {
header: {
text: 'some Terminal',
toolbar: '✕'
},
prompt: '/ >',
commands: [
{command: 'ls', result: 'file1 file2'},
{command: 'whoami', result: 'root'}
]
}
}
}
}
Visit the wiki for more examples.
The component accepts the following three props:
header
- type: objectprompt
- type: stringcommands
- type: array of objects
None of these are required, neither are their respective attributes. All attributes can contain html entities.
type: object
Attribute | Type | Default | Example |
---|---|---|---|
text | string | '' |
'xterm' |
toolbar | string | <span style="color: lightgrey;">●</span> <span>●</span> ● ● |
'- X' |
type: string
Default | Example |
---|---|
'$' |
'$>' |
type: array of objects
Attribute | Type | Default | Example |
---|---|---|---|
prompt | string | undefined . The global prompt will be used |
'$>' |
command | string | '' |
'whoami' |
result | string | '' |
'root' |