Terminal — 명령줄을 흉내 내는 텍스트 기반 컴포넌트
Terminal은 커맨드라인처럼 동작하는 텍스트 기반 인터페이스 컴포넌트예요. 사용자가 명령어를 입력하면 응답을 받아오는 구조라서, 콘솔 실습이나 대화형 도구를 만들 때 잘 어울려요.
출처: 문서
본문
Terminal은 기준 인터페이스 위에서 명령줄 경험(command line experience)을 흉내 내는 텍스트 기반 컴포넌트예요. 사용자가 명령어를 입력하고 응답을 받을 수 있어요.
사용법 (Usage)
import { Terminal } from '@primereact/ui/terminal';
<Terminal.Root>
<Terminal.Welcome />
<Terminal.CommandList />
</Terminal.Root>
예시
기본 (Basic)
텍스트 명령어를 받아 응답하는 대화형 터미널이에요.
템플릿 (Template)
렌더 함수를 사용해 커스텀 명령어 표시를 만들 수 있어요. 출력 스타일링을 완전히 제어할 수 있죠.
파일 시스템 (File System)
ls, cd, cat, pwd 같은 탐색 명령어를 보여 주는 대화형 파일 브라우저예요.
AI 어시스턴트 (AI Assistant)
타이핑 표시(typing indicator)가 있는 채팅 스타일 인터페이스예요. Terminal을 대화형 경험에 맞게 스타일링하는 방법을 보여줘요.
관련 자료
하위 컴포넌트 (Sub-Components)
전체 하위 컴포넌트 API는 Terminal Primitive에서 확인할 수 있어요.
훅 (Hooks)
Headless 훅 API는 useTerminal에서 확인할 수 있어요.
접근성 (Accessibility)
WAI-ARIA 준수 사항과 키보드 지원에 대한 자세한 내용은 Terminal Primitive에서 볼 수 있어요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-terminal | Class name of the root element |
| p-terminal-welcome-message | Class name of the welcome element |
| p-terminal-command-list | Class name of the command list element |
| p-terminal-command | Class name of the command element |
| p-terminal-command-value | Class name of the command value element |
| p-terminal-command-response | Class name of the command response element |
| p-terminal-prompt | Class name of the prompt element |
| p-terminal-prompt-label | Class name of the prompt label element |
| p-terminal-prompt-value | Class name of the prompt value element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| terminal.background | --p-terminal-background | Background of root |
| terminal.border.color | --p-terminal-border-color | Border color of root |
| terminal.color | --p-terminal-color | Color of root |
| terminal.height | --p-terminal-height | Height of root |
| terminal.padding | --p-terminal-padding | Padding of root |
| terminal.border.radius | --p-terminal-border-radius | Border radius of root |
| terminal.font.weight | --p-terminal-font-weight | Font weight of root |
| terminal.font.size | --p-terminal-font-size | Font size of root |
| terminal.prompt.gap | --p-terminal-prompt-gap | Gap of prompt |
| terminal.command.response.margin | --p-terminal-command-response-margin | Margin of command response |