Talebook by Syncfusion

I'm completely new to Storybook and I am currently exploring the possibility of creating a Storybook application that showcases a variety of controls, including Syncfusion controls and other custom controls that I will be developing in the future.

Has anyone had experience integrating an existing UI Library such as Syncfusion with Storybook?

UPDATE: I have discovered that Storybook Decorators can be used for this purpose.

Regarding decorators:

[moduleMetadata({ declarations: [ButtonComponent], imports: [ButtonModule]})] 

The ButtonComponent contains a component utilizing the Syncfusion Button, while the ButtonModule is the module for the Syncfusion Button. This information is provided as a temporary comment since I am unsure if this is the correct approach.

Answer №1

Absolutely, our Syncfusion controls seamlessly integrate with the Storybook application. This means that you can incorporate the Syncfusion library into your Storybook application effortlessly. To assist you with this process, we recommend following the steps outlined below.

Step 1: Begin by creating a new Angular CLI application and include our simple button component. Refer to the documentation provided at the link below for detailed instructions.

Documentation:

Step 2: Navigate to your Angular project directory and execute the following shell command to add Storybook to your project.

npx sb init

You will notice that the stories and Storybook files have been successfully added to your project folder.

Step 3: Create a new “.ts” file within the “./src/stories/ej2button.stories.ts” directory, and populate it with the script snippets provided below.

import { Story, Meta } from '@storybook/angular/types-6-0';
import { ButtonComponent, Button } from '@syncfusion/ej2-angular-buttons';

export default {
  title: 'Example/SyncfusionEJ2Button',
  component: ButtonComponent,
  argTypes: {
    // backgroundColor: { control: 'color' },
  },
} as Meta;

const Template: Story<ButtonComponent> = (args: ButtonComponent) => ({
  component: ButtonComponent,
  props: args,
});

export const Primary = Template.bind({});
Primary.args = {
  cssClass: 'e-primary',
  content: 'Button',
};

export const Secondary = Template.bind({});
Secondary.args = {
  content: 'Button',
};

Step 4: Additionally, create a new “.html” file in the “./storybook/preview-head.html” directory, and insert the CDN link for styles as shown below.

<link href=https://cdn.syncfusion.com/ej2/material.css rel="stylesheet" type="text/css"/>

Step 5: Launch the Storybook application in a browser window by executing the command provided below.

npm run storybook

The Storybook application interface should now be visible in your browser window.

Output

To make things easier for you, we have included a sample Button component within the Storybook. Feel free to download and utilize this sample from the link below.

Sample:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way for me to extract information from a static HTML page, like the meta tag, in a simple manner

In my Angular 2 application, I am using Flask (Python framework) to serve up the static HTML content when accessed through the index. My goal is to show the version of the application on the AboutComponent. Currently, I have Flask injecting the version int ...

An issue has occurred while attempting to differentiate '[object Object]'. Please note that only arrays and iterable objects are permitted

myComponent.component.ts ngOnInit() { this.getData.getAllData().subscribe( response => { console.log(response); this.dataArray = response; }, () => console.log('there was an error') ); } myservi ...

Optimizing font loading with angular CLI

EDIT: AFAIK This is a unique question and not related to Webpack disable hashing of image name on output because: The webpack.config file is no longer editable in the latest versions of Angular CLI. I actually want to keep the hash on the fon ...

Error Encountered: Kendo Angular 4 Peer Dependency Issue and Module "rxjs/operators/combineLatest" Not Found

I'm currently facing issues while attempting to integrate Kendo UI into an Angular 4 application, encountering various errors along the way. To begin, I initiated the installation by running this command: npm install --save @progress/kendo-angular-d ...

The additional parameters I am trying to append are being overwritten by the set parameters in the httpInterceptor

Issue Description: I have implemented an HttpInterceptor that adds an id and token to all requests when the user's credentials are available. However, I am facing the problem of the interceptor overwriting any additional HttpParams added to a request. ...

Show various perspectives depending on the circumstances

I am looking for a solution to display a different component if my ngFor loop returns null. <ion-select interface="popover" [ngModel]="selectedKidId"> <ion-option *ngFor="let kid of kids" [value]="kid.id">{{kid.name}}</ion-option& ...

What is the best approach for managing and obtaining accurate JSON responses when working with PHP API and AngularJS 2 services?

Encountering a backend issue with MySQL, wherein one query is producing a specific dataset: {"candidat":[{"ID":1,"nom":"Danny","prenom":"Hariot","parti":"Quamba","departement":"Ukraine","commune":"Chapayeve"},{"ID":2,"nom":"Shari","prenom":"Adamkiewicz"," ...

encountered an error stating module '@angular/compiler-cli/ngc' could not be located while attempting to execute ng serve

Here is the content of my package.json file: { "name": "cal-euc", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build&qu ...

What is the process for creating a unit test case for an Angular service page?

How can I create test cases for the service page using Jasmine? I attempted to write unit tests for the following function. service.page.ts get(): Observable<Array<modelsample>> { const endpoint = "URL" ; return ...

Learn the process of generating an ID and dynamically updating its content using Angular

I have a coding challenge where I need to dynamically create an ID and retrieve it in order to change its content upon clicking. Here is the code snippet: <div class="row" *ngFor="let row of [1, 2, 3]"> <button (click)=&quo ...

Ensure that an HTTP post request is successfully completed before proceeding to execute the next HTTP post request within a loop

I have a loop that sends a HTTP post request each time it iterates. for(let i = 1; i < this.data.length; i++) { let arr = this.data[i]; this.http.post('link here', { name: arr[0], gender: arr[1], course: ar ...

Encountering difficulties with implementing reactive forms in an Ionic Angular 7 project as the app.module.ts file appears to be missing

Currently, I am working on a project using Ionic Angular 7 and I am facing some challenges with implementing reactive forms. Since app.module.ts is not in Ionic Angular 7 anymore, I tried to search for solutions online. Unfortunately, when I followed the i ...

Showing Firebase messages in a NativeScript ListView in an asynchronous manner

I am currently struggling to display asynchronous messages in a ListView using data fetched from Firebase through the popular NativeScript Plugin. While I have successfully initialized, logged in, and received the messages, I'm facing challenges in ge ...

Switching Workspaces in Visual Studio

Is it possible to switch from an existing project to a new one in Visual Studio using NPM? ...

Troubleshooting a CORS problem with connecting an Angular application to a Node server that is accessing the Spotify

I am currently working on setting up an authentication flow using the Spotify API. In this setup, my Angular application is making calls to my Node server which is running on localhost:3000. export class SpotifyService { private apiRoot = 'http://lo ...

@ngrx effects ensure switchmap does not stop on error

Throughout the sign up process, I make 3 http calls: signing up with an auth provider, creating an account within the API, and then logging in. If the signup with the auth provider fails (e.g. due to an existing account), the process still tries to create ...

There was an issue with the specified entry-point "auth0/angular-jwt" as it is missing required dependencies

I am currently working on an Angular project with the following versions: @angular-devkit/architect 0.901.1 @angular-devkit/core 9.1.1 @angular-devkit/schematics 9.1.1 @schematics/angular 9.1.1 @schematics/update 0.901.1 rx ...

What is the best way to implement filter functionality for individual columns in an Angular material table using ngFor?

I am using ngFor to populate my column names and corresponding data in Angular. How can I implement a separate filter row for each column in an Angular Material table? This filter row should appear below the header row, which displays the different column ...

I'm having trouble getting filters to function properly with the ais-configure Widget in Algolia

I'm working with Angular's ais-configure feature and trying to implement filters in the searchParameters like this: <ais-configure [searchParameters]="{ filters: 'isPrivate:false' }"> The goal here is to filter based on a boolea ...

What is the correct way to declare a DocumentReference type within an Angular TypeScript interface?

Thank you for taking the time to read my inquiry. Technologies used: Angular 13, Firebase Firestore v9 database, and Firebase Authentication. My question pertains to the process of signing up a user through Firestore Authentication. Upon signup, I need ...