Terminal is a text based user interface. Enter "date" to display the current date.
import { Terminal } from 'primeng/terminal';
Commands are processed using observables via the TerminalService. Import this service into your component and subscribe to commandHandler to process commands by sending replies with sendResponse function.
Enter "date" to display the current date, "greet {0}" for a message and "random" to get a random number.
<p>Enter "<strong>date</strong>" to display the current date,
"<strong>greet {0}</strong>" for a message and "<strong>random</strong>"
to get a random number.</p>
<p-terminal welcomeMessage="Welcome to PrimeNG" prompt="primeng $" />
Terminal component has an input element that can be described with aria-label or aria-labelledby props. The element that lists the previous commands has aria-live so that changes are received by the screen reader.
Key | Function |
---|---|
tab | Moves focus through the input element. |
enter | Executes the command when focus in on the input element. |