Terminal API
API documentation for Terminal component
Terminal#
Props#
Defines valid properties in Terminal component.
| name | type | default | description |
|---|
| ref | Ref<unknown> | null | The reference to the component instance. |
| pIf | boolean | true | Whether the component should be rendered. |
| style | CSSProperties | ((instance?: TerminalInstance) => CSSProperties) | null | The style to apply to the component. |
| className | string | ((instance?: TerminalInstance) => string) | null | The class name to apply to the component. |
| as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | null | The component type to render. |
| asChild | boolean | false | Whether the component should be rendered as a child component. |
| pt | SafeRecord<TerminalPassThrough> | null | The pass-through props to pass to the component |
| ptOptions | PassThroughOptions | null | The pass-through options to pass to the component |
| unstyled | boolean | null | Whether the component should be rendered without classes. |
| dt | unknown | null | The design token to use for the component. |
| styles | StylesOptions<ComponentInstance> | null | The styles to use for the component. |
| children | ReactNode | ((instance: TerminalInstance) => ReactNode) | null | The children to render. |
| prompt | string | null | Prompt text for each command. |
| [key: string] | any | null | |
| pt-{optionName}-* | - | null | Pass through attributes for customizing component. For more info, see Pass Through tab. |
State#
Defines valid state in Terminal component.
| name | type | default | description |
|---|
| commandText | string | null | Current command text being typed. |
| commands | TerminalCommandItem[] | null | Array of commands and their responses. |
Exposes#
Defines the methods and properties exposed by Terminal component.
| name | type | default | description |
|---|
| state | useTerminalState | null | State of the terminal. |
| inputRef | RefObject<HTMLInputElement> | null | Reference to the input element. |
| onClick | () => void | null | Click handler for terminal container. |
| onKeyDown | (event: KeyboardEvent<HTMLInputElement>) => void | null | Key down handler for input element. |
| onInputChange | (event: ChangeEvent<HTMLInputElement>) => void | null | Input change handler. |
Interfaces#
PassThroughOptions
Defines passthrough(pt) options of Terminal component.
| name | type | default | description |
|---|
| root | TerminalPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the root's DOM element. |
| commandList | TerminalPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the commandList's DOM element. |
| commands | TerminalPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the commands' DOM element. |
| commandValue | TerminalPassThroughType<HTMLAttributes<HTMLSpanElement>> | null | Used to pass attributes to the command value's DOM element. |
| commandResponse | TerminalPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the command response's DOM element. |
| prompt | TerminalPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the prompt's DOM element. |
| promptValue | TerminalPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the prompt value's DOM element. |
| promptLabel | TerminalPassThroughType<HTMLAttributes<HTMLSpanElement>> | null | Used to pass attributes to the prompt label's DOM element. |
Types#
Instance
Instance of Terminal component.
| values |
|---|
| ComponentInstance<TerminalProps, TerminalState, TerminalExposes> |
TerminalWelcome#
Props#
Defines valid properties in TerminalWelcome component.
| name | type | default | description |
|---|
| ref | Ref<unknown> | null | The reference to the component instance. |
| pIf | boolean | true | Whether the component should be rendered. |
| style | CSSProperties | ((instance?: TerminalWelcomeInstance) => CSSProperties) | null | The style to apply to the component. |
| className | string | ((instance?: TerminalWelcomeInstance) => string) | null | The class name to apply to the component. |
| as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | null | The component type to render. |
| asChild | boolean | false | Whether the component should be rendered as a child component. |
| pt | SafeRecord<TerminalWelcomePassThrough> | null | The pass-through props to pass to the component |
| ptOptions | PassThroughOptions | null | The pass-through options to pass to the component |
| unstyled | boolean | null | Whether the component should be rendered without classes. |
| dt | unknown | null | The design token to use for the component. |
| styles | StylesOptions<ComponentInstance> | null | The styles to use for the component. |
| children | ReactNode | ((instance: TerminalWelcomeInstance) => ReactNode) | null | The children to render. |
| [key: string] | any | null | |
| pt-{optionName}-* | - | null | Pass through attributes for customizing component. For more info, see Pass Through tab. |
Exposes#
Defines the methods and properties exposed by TerminalWelcome component.
| name | type | default | description |
|---|
| terminal | TerminalInstance | null | The Terminal component instance. |
Interfaces#
PassThroughOptions
Defines passthrough(pt) options of TerminalWelcome component.
| name | type | default | description |
|---|
| root | TerminalWelcomePassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the root's DOM element. |
Types#
Instance
Instance of TerminalWelcome component.
| values |
|---|
| ComponentInstance<TerminalWelcomeProps, TerminalWelcomeState, TerminalWelcomeExposes> |
TerminalCommandList#
Props#
Defines valid properties in TerminalCommandList component.
| name | type | default | description |
|---|
| ref | Ref<unknown> | null | The reference to the component instance. |
| pIf | boolean | true | Whether the component should be rendered. |
| style | CSSProperties | ((instance?: TerminalCommandListInstance) => CSSProperties) | null | The style to apply to the component. |
| className | string | ((instance?: TerminalCommandListInstance) => string) | null | The class name to apply to the component. |
| as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | null | The component type to render. |
| asChild | boolean | false | Whether the component should be rendered as a child component. |
| pt | SafeRecord<TerminalCommandListPassThrough> | null | The pass-through props to pass to the component |
| ptOptions | PassThroughOptions | null | The pass-through options to pass to the component |
| unstyled | boolean | null | Whether the component should be rendered without classes. |
| dt | unknown | null | The design token to use for the component. |
| styles | StylesOptions<ComponentInstance> | null | The styles to use for the component. |
| children | ReactNode | ((instance: TerminalCommandListInstance) => ReactNode) | null | The children to render. |
| [key: string] | any | null | |
| pt-{optionName}-* | - | null | Pass through attributes for customizing component. For more info, see Pass Through tab. |
Exposes#
Defines the methods and properties exposed by TerminalCommandList component.
| name | type | default | description |
|---|
| terminal | TerminalInstance | null | The Terminal component instance. |
Interfaces#
PassThroughOptions
Defines passthrough(pt) options of TerminalCommandList component.
| name | type | default | description |
|---|
| root | TerminalCommandListPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the root's DOM element. |
Types#
Instance
Instance of TerminalCommandList component.
| values |
|---|
| ComponentInstance<TerminalCommandListProps, TerminalCommandListState, TerminalCommandListExposes> |
useTerminal#
Props#
Defines valid properties in useTerminal.
| name | type | default | description |
|---|
| prompt | string | null | Prompt text for each command. |
State#
Defines valid state in useTerminal.
| name | type | default | description |
|---|
| commandText | string | null | Current command text being typed. |
| commands | TerminalCommandItem[] | null | Array of commands and their responses. |
Exposes#
Defines the methods and properties exposed by useTerminal.
| name | type | default | description |
|---|
| state | useTerminalState | null | State of the terminal. |
| inputRef | RefObject<HTMLInputElement> | null | Reference to the input element. |
| onClick | () => void | null | Click handler for terminal container. |
| onKeyDown | (event: KeyboardEvent<HTMLInputElement>) => void | null | Key down handler for input element. |
| onInputChange | (event: ChangeEvent<HTMLInputElement>) => void | null | Input change handler. |
Types#
Instance
Instance of useTerminal headless.
| values |
|---|
| HeadlessInstance<useTerminalProps, useTerminalState, useTerminalExposes> |