diff --git a/projects/addon-doc/components/demo/index.html b/projects/addon-doc/components/demo/index.html
index 8c4b82f8e970..5ab79f61cc1b 100644
--- a/projects/addon-doc/components/demo/index.html
+++ b/projects/addon-doc/components/demo/index.html
@@ -25,6 +25,7 @@
class="t-wrapper"
[attr.tuiTheme]="theme()"
[class.t-wrapper_transparent]="!opaque"
+ [style.visibility]="rendered() ? 'visible' : 'hidden'"
>
;
@@ -76,6 +79,8 @@ export class TuiDocDemo implements OnInit {
private readonly resizer?: ElementRef;
private readonly el = tuiInjectElement();
+ private readonly destroyRef = inject(DestroyRef);
+ private readonly ngZone = inject(NgZone);
private readonly locationRef = inject(Location);
private readonly urlSerializer = inject(UrlSerializer);
private readonly urlStateHandler = inject(TUI_DOC_URL_STATE_HANDLER);
@@ -84,6 +89,8 @@ export class TuiDocDemo implements OnInit {
@ContentChild(TemplateRef)
protected readonly template: TemplateRef> | null = null;
+ protected readonly rendered = signal(false);
+
protected theme = computed(() => (this.dark() ? 'dark' : 'light'));
protected dark = signal(
@@ -112,9 +119,14 @@ export class TuiDocDemo implements OnInit {
@Input()
public sticky = true;
- public ngOnInit(): void {
- this.createForm();
- this.updateWidth(this.sandboxWidth + this.delta);
+ public ngAfterViewInit(): void {
+ timer(0, tuiZonefreeScheduler(this.ngZone))
+ .pipe(takeUntilDestroyed(this.destroyRef))
+ .subscribe(() => {
+ this.createForm();
+ this.updateWidth(this.sandboxWidth + this.delta);
+ this.rendered.set(true);
+ });
}
protected onResize(): void {