ComponentContent

Learn how to type component content in your JavaScript application.

This type resolves the content type for a versioned Component ID.

Signature

This type has the following signature:

type ComponentContent<I extends VersionedComponentId>

Usage

Pass a versioned component ID like 'card@1' to get the corresponding content type. This is useful when multiple slots reference the same component and you need shared rendering logic:

1234567
import type {ComponentContent} from '@croct/plug';
type CardProps = ComponentContent<'card@1'>;
export function Card(props: CardProps) {  return <div>{props.title}</div>;}

When using CLI-generated types, the type parameter is constrained to known component IDs, providing autocompletion and type safety.