22title : " @expand"
33---
44
5- # @expand
5+ # Expand Tags
6+
7+ The ` @expand ` , ` @expandType ` , and ` @preventExpand ` tags can be used to control
8+ how TypeDoc _ displays_ references to type aliases and interfaces.
9+
10+ ## @expand
611
712** Tag Kind:** [ Modifier] ( ../tags.md#modifier-tags )
813
@@ -15,7 +20,7 @@ wherever it is referenced and TypeDoc has a place to include it.
1520> documentation if it is applied to commonly used types as it will result in
1621> inlining the comments for those types everywhere they are referenced.
1722
18- ## Example
23+ ### Example
1924
2025This is particularly useful for React components, where the documentation for
2126props is useful when viewing the component function. The ` Hello ` component below
@@ -52,6 +57,65 @@ export function Hello2(props: HelloProps) {
5257}
5358```
5459
60+ ## @expandType
61+
62+ ** Tag Kind:** [ Block] ( ../tags.md#block-tags )
63+
64+ The ` @expandType ` can be placed on any reflection to tell TypeDoc to expand a type
65+ reference when rendering it within that reflection. It should specify the type name
66+ without type arguments.
67+
68+ ` @expandType ` is inherited, it may be placed on a namespace or module where there are
69+ multiple references to a type to instruct TypeDoc to expand the type everywhere in that
70+ module.
71+
72+ ### Example
73+
74+ TypeDoc will expand ` HelloProps ` within ` Hello ` as if ` @expand ` had been placed
75+ on ` HelloProps ` .
76+
77+ ``` ts
78+ export type HelloProps = {
79+ /** Name description */
80+ name: string ;
81+ };
82+
83+ /**
84+ * Hello component
85+ * @expandType HelloProps
86+ */
87+ export function Hello(props : HelloProps ) {
88+ return <span >Hello {props.name }! < / span > ;
89+ }
90+ ```
91+
92+ ## @preventExpand
93+
94+ ** Tag Kind:** [ Block] ( ../tags.md#block-tags )
95+
96+ The ` @preventExpand ` block tag can be used to instruct TypeDoc to not expand a
97+ tag which has been expanded with ` @expand ` , ` @preventExpand ` , or by highlighting
98+ properties of the reference type with ` @param ` .
99+
100+ ``` tsx
101+ /**
102+ * @expand
103+ */
104+ export type HelloProps = {
105+ /** Name property docs */
106+ name: string ;
107+ };
108+
109+ /**
110+ * Hello component - HelloProps will NOT be expanded here
111+ * @preventExpand HelloProps
112+ */
113+ export function Hello2(props : HelloProps ) {
114+ return <span >Hello { props .name } !</span >;
115+ }
116+ ```
117+
55118## See Also
56119
57- - The [ ` @inline ` ] ( inline.md ) tag
120+ - The [ ` @inline ` ] ( inline.md ) tags
121+ - The [ ` @param ` ] ( param.md ) tag
0 commit comments