Skip to content
@ng-doc/app / Class

NgDocDemoComponent

Renders a demo of the page in a panel: a toolbar with Preview and source tabs, the preview width, copy and fullscreen controls, over the demo on a dot-grid stage. The fullscreen control shows the stage fullscreen with the browser Fullscreen API; it is hidden where the browser does not support it.

When the Vite engine built demo pages for the page (NgDocRootPage.demoRoute), the toolbar opens the demo's page in a new tab, and an isolated demo (the isolated option, or isolatedDemos) is shown in an iframe of its page: the preview widths are then the width of the iframe's viewport, so media queries inside the demo respond to them. Otherwise the demo renders in the page, and the preview widths set the width of its container only.

Decorators
@Component
Selectors
ng-doc-demo
DeclarationTypeScript
@Component({ … })
export class NgDocDemoComponent { … }

Members

Properties

15
readonly

Source files of the demo, filtered by the tabs option.

componentName: InputSignal<string | undefined>
readonly input()

Name of the demo component in the page's demos.

copyText: () => string
protectedreadonly

Reads the code of the open source file (or the default one) when copy is pressed.

demo: Signal<Type<unknown> | undefined>
readonly

The demo component.

demoUrl: Signal<string | undefined>
readonly

The URL of the demo's page, when the page has demo pages and the demo exists: the generated demo route and the demo's name under the base href, with the inputs option as a query parameter.

frameTitle: Signal<string>
protectedreadonly

The accessible title of the demo's iframe.

fullscreen: Signal<boolean>
protectedreadonly

Whether the stage is fullscreen.

idPrefix: string
protectedreadonly

Prefix of the ids that tie the view tabs to their panels.

isolated: Signal<boolean>
readonly

Whether the demo is shown in an iframe of its page.

readonly input()

Options of the demo action.

readonly

The width the demo is previewed at.

previewWidths: readonly { readonly width: NgDocDemoPreviewWidth; readonly label: string; readonly readout: string; }[]
protectedreadonly
—
view: WritableSignal<string>
readonly

The open view: preview, or the title of a source file. It starts on the preview, or on the default source file when the expanded option is set.

views: Signal<string[]>
protectedreadonly

The views in tab order: the preview, then the source files.

widthReadout: Signal<string>
protectedreadonly

Readout of the preview width.

Methods

2
(…): void
protected

Moves between the view tabs with the keyboard.

(…): void

Opens a view.

Symbol
Kind
Class
Decorators
@Component
Selectors
ng-doc-demo
Scope
@ng-doc/app
Edit this page