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

22
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.

copyTexts: NgDocCopyTexts
protectedreadonly
—
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.

frameFragment: Signal<string | undefined>
protectedreadonly

The URL fragment of the demo's iframe, which carries its theme.

frameTheme: WritableSignal<string | undefined>
readonly

The theme of the demo's iframe: the theme option, until the reader picks another with the theme button; undefined follows the page.

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.

newTabUrl: Signal<string | undefined>
protectedreadonly

The demo's page as the toolbar opens it in a new tab: in the theme of its iframe.

readonly input()

Options of the demo action.

readonly

The width the demo is previewed at.

previewWidths: { width: NgDocDemoPreviewWidth; label: string; readout: string; }[]
protectedreadonly
—
stageBackground: Signal<string | undefined>
protectedreadonly

The background of the stage while the demo shows a theme of its own: the background its page reported, so the whole stage reads in the demo's theme rather than only the iframe.

stageDots: Signal<string | undefined>
protectedreadonly

The dots of the stage while the demo shows a theme of its own, in that theme's color.

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