Terminal is a text based user interface.
import { Terminal } from 'primereact/terminal';
import { TerminalService } from 'primereact/terminalservice';
Terminal is interacted with TerminalService api using command, response and clear events. The command event requires a callback to handle the commands, the responseemits the response of the command and emitting clear reset the terminal.
Enter "date" to display the current date, "greet {0}" for a message, "random" to get a random number and "clear" to clear all commands.
<Terminal welcomeMessage="Welcome to PrimeReact" prompt="primereact $" />
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
p-terminal | Container element. |
p-terminal-content | Content of terminal. |
p-terminal-prompt | Prompt text. |
p-terminal-response | Command response. |
p-terminal-input | Input element to enter commands. |
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. |