How to use the @storybook/angular.moduleMetadata function in @storybook/angular

To help you get started, we’ve selected a few @storybook/angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dotCMS / core-web / src / app / view / components / _common / dot-avatar / dot-avatar.component.stories.ts View on Github external
import { storiesOf, moduleMetadata } from '@storybook/angular';
// import { action } from '@storybook/addon-actions';

import { DotAvatarComponent } from './dot-avatar.component';

storiesOf('DotAvatarComponent', module)
    .addDecorator(
        moduleMetadata({
            declarations: [DotAvatarComponent]
        })
    )
    .add('default', () => {
        return {
            template: ``,
            props: {}
        };
    })
    .add('no url', () => {
        return {
            template: ``,
            props: {}
        };
    });
github storybookjs / storybook / examples / angular-cli / src / stories / addon-background.stories.ts View on Github external
import { moduleMetadata, storiesOf } from '@storybook/angular';
import { Button } from '@storybook/angular/demo';
import { AppComponent } from '../app/app.component';

storiesOf('Addon|Background', module)
  .addParameters({
    backgrounds: [{ name: 'twitter', value: '#00aced', default: true }, { name: 'facebook', value: '#3b5998' }],
  })
  .add('background component', () => ({
    component: AppComponent,
    props: {},
  }));

storiesOf('Addon|Background', module)
  .addDecorator(
    moduleMetadata({
      declarations: [Button],
    })
  )
  .addParameters({
    backgrounds: [{ name: 'twitter', value: '#00aced', default: true }, { name: 'facebook', value: '#3b5998' }],
  })
  .add('background template', () => ({
    template: ``,
    props: {
      text: 'Hello Button',
      onClick: (event: Event) => {
        console.log('some bindings work');
        console.log(event);
      },
    },
  }));
github IBM / carbon-components-angular / src / patterns / filtering / multiple-categories.stories.ts View on Github external
this.model.data = this.dataset.map(datapoint => 
            [
                new TableItem({ data: datapoint.name}),
                new TableItem({ data: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." })
            ]
        );
    }
    ngOnDestroy() {
        document.querySelector('.sb-show-main').classList.remove('full-page');
    }
}

storiesOf("Patterns|Filtering", module)
	.addDecorator(
		moduleMetadata({
			declarations: [ SampleMultiCategories ],
			imports: [
				TableModule,
				DropdownModule,
				GridModule,
				StructuredListModule,
				RadioModule,
				CheckboxModule,
				ButtonModule,
				TagModule,
				UIShellModule
			]
		})
	)
	.addDecorator(withKnobs)
	.add("Multiple Categories", () => ({
github marklogic / marklogic-data-hub / web / src / main / ui / app / components / mappings / stories / map-ui.component.stories.ts View on Github external
import {CommonModule} from '@angular/common';
import {RouterModule} from '@angular/router';
import {moduleMetadata, storiesOf} from '@storybook/angular';
import {centered} from '@storybook/addon-centered/angular';
import {boolean, object, text, withKnobs} from '@storybook/addon-knobs';
import {action} from '@storybook/addon-actions';
import {TooltipModule} from 'ngx-bootstrap';
import {StoryCardComponent} from '../../../utils';
import {MapUiComponent, ThemeModule} from "../..";
import {FocusElementDirective} from '../../../directives/focus-element/focus-element.directive';
import {ListFilterPipe} from '../ui/listfilter.pipe';

storiesOf('Components|Mappings', module)
  .addDecorator(withKnobs)
  .addDecorator(
    moduleMetadata({
      imports: [
        CommonModule,
        ThemeModule,
        RouterModule.forRoot([], { useHash: true }),
        TooltipModule.forRoot()
      ],
      schemas: [],
      declarations: [
        MapUiComponent,
        FocusElementDirective,
        ListFilterPipe,
        StoryCardComponent
      ],
      entryComponents: [],
      providers: []
    })
github marklogic / marklogic-data-hub / web / src / main / ui / app / components / trace-viewer / stories / trace-viewer.component.stories.ts View on Github external
import {CommonModule} from '@angular/common';
import {moduleMetadata, storiesOf} from '@storybook/angular';
import {centered} from '@storybook/addon-centered/angular';
import {boolean, object, text, withKnobs} from '@storybook/addon-knobs';
import {action} from '@storybook/addon-actions';
import {StoryCardComponent} from '../../../utils';
import {MlErrorComponent, ThemeModule, TraceViewerUiComponent} from "../../index";
import {CodemirrorComponent} from '../../codemirror';

storiesOf('Components|Trace Viewer', module)
  .addDecorator(withKnobs)
  .addDecorator(
    moduleMetadata({
      imports: [CommonModule, ThemeModule],
      schemas: [],
      declarations: [
        TraceViewerUiComponent,
        MlErrorComponent,
        CodemirrorComponent,
        StoryCardComponent
      ],
      entryComponents: [],
      providers: []
    })
  )
  .addDecorator(centered)
  .add('Trace Viewer Component', () => ({
    template: `
github marklogic / marklogic-data-hub / quick-start / src / main / ui / app / components / traces / stories / traces-ui.component.stories.ts View on Github external
import {moduleMetadata, storiesOf} from '@storybook/angular';

import {DatePipePipe} from '../../../pipes/date-pipe/date-pipe.pipe';
import {ObjectToArrayPipe} from '../../../object-to-array.pipe';
import {TruncateCharactersPipe} from '../../../pipes/truncate';
import {PaginationComponent} from '../../pagination';
import {SelectComponent, ThemeModule} from '../..';
import {TracesUiComponent} from '../ui';
import {StoryCardComponent} from '../../../utils';
import {FacetsComponent} from '../../facets/facets.component';

storiesOf('Components|Traces', module)
  .addDecorator(withKnobs)
  .addDecorator(centered)
  .addDecorator(
    moduleMetadata({
      imports: [
        ThemeModule
      ],
      declarations: [
        ObjectToArrayPipe,
        FacetsComponent,
        PaginationComponent,
        SelectComponent,
        StoryCardComponent,
        TracesUiComponent,
        TruncateCharactersPipe,
        DatePipePipe
      ]
    })
  )
  .add('Traces Component', () => ({
github marklogic / marklogic-data-hub / quick-start / src / main / ui / app / shared / stories / components / mappings / map-ui.component.stories.ts View on Github external
text,
  boolean,
  withKnobs
} from '@storybook/addon-knobs';
import {action} from '@storybook/addon-actions';
import { TooltipModule } from 'ngx-bootstrap';
import {StoryCardComponent} from '../../utils';
import {ThemeModule} from "../../../components";
import {MapUiComponent} from "../../../components";
import {FocusElementDirective} from '../../../directives/focus-element/focus-element.directive';
import {ListFilterPipe} from '../../../components/mappings/listfilter.pipe';

storiesOf('Components|Mappings', module)
  .addDecorator(withKnobs)
  .addDecorator(
    moduleMetadata({
      imports: [
        CommonModule,
        ThemeModule,
        RouterModule.forRoot([], { useHash: true }),
        TooltipModule.forRoot()
      ],
      schemas: [],
      declarations: [
        MapUiComponent,
        FocusElementDirective,
        ListFilterPipe,
        StoryCardComponent
      ],
      entryComponents: [],
      providers: []
    })
github IBM / carbon-components-angular / src / accordion / accordion.stories.ts View on Github external
import { storiesOf, moduleMetadata } from "@storybook/angular";
import { action } from "@storybook/addon-actions";
import { withKnobs, boolean, object } from "@storybook/addon-knobs/angular";

import { AccordionModule, DocumentationModule } from "../";

storiesOf("Components|Accordion", module)
	.addDecorator(
		moduleMetadata({
			imports: [
				AccordionModule,
				DocumentationModule
			]
		})
	)
	.addDecorator(withKnobs)
	.add("Basic", () => ({
		template: `
			
				Lorem ipsum dolor sit amet, \
				consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore \
				et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation \
				ullamco laboris nisi ut aliquip ex ea commodo consequat.
				Lorem ipsum dolor sit amet, \
				consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore \
github IBM / carbon-components-angular / src / table / table.stories.ts View on Github external
const getProps = (more = {}) => {
	return Object.assign({}, {
		model: simpleModel,
		size: select("size", { Small: "sm", Short: "sh", Normal: "md", Large: "lg" }, "md"),
		title: text("Title", "Table title"),
		description: text("Description", ""),
		showSelectionColumn: boolean("showSelectionColumn", true),
		striped: boolean("striped", false),
		sortable: boolean("sortable", true),
		isDataGrid: boolean("Data grid keyboard interactions", true)
	}, more);
};

storiesOf("Table", module).addDecorator(
		moduleMetadata({
			imports: [
				NFormsModule,
				TableModule,
				DialogModule,
				PaginationModule,
				SearchModule,
				ButtonModule,
				Settings16Module,
				Delete16Module,
				Save16Module,
				Download16Module,
				Add20Module,
				DocumentationModule
			],
			declarations: [
				TableStory,
github TemainfoSoftware / truly-ui / src / stories / calendar / calendar.stories.ts View on Github external
*     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *     SOFTWARE.
 * /
 */

import { moduleMetadata, storiesOf } from '@storybook/angular';
import { CoreModule } from '../../../projects/truly-ui/src/components/core';
import { CalendarModule } from '../../../projects/truly-ui/src/components/calendar';
import { boolean } from '@storybook/addon-knobs';


const Story = storiesOf('Data Display|Calendar', module)
  .addDecorator(
    moduleMetadata({
      imports: [
        CalendarModule,
        CoreModule.forRoot({
          theme: 'default',
        }),
      ],
    })
  );


Story.add('Overview', () => {

  const showTodayButton = boolean('Show Today Button', false);

  return {
    template: ``,

@storybook/angular

Storybook for Angular: Develop Angular components in isolation with hot reloading.

MIT
Latest version published 17 days ago

Package Health Score

98 / 100
Full package analysis