📄 ink/hooks/use-stdout

File: use-stdout.md | Updated: 11/16/2025

useStdout

useStdout is a React hook that exposes the stdout stream where Ink renders your app.

Usage

import {useStdout} from 'ink';

const Example = () => {
	const {stdout} = useStdout();

	return …
};

See additional usage example in examples/use-stdout.

API

stdout

Type: stream.Writable
Default: process.stdout

write(data)

Write any string to stdout while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to <Static>, except it can't accept components; it only works with strings.

data

Type: string

Data to write to stdout.

Example

import {useStdout} from 'ink';

const Example = () => {
	const {write} = useStdout();

	useEffect(() => {
		// Write a single message to stdout, above Ink's output
		write('Hello from Ink to stdout\n');
	}, []);

	return …
};