@storybook/angular
Version:
Storybook for Angular: Develop Angular components in isolation with hot reloading.
49 lines (41 loc) • 1.1 kB
text/typescript
import { CommonModule } from '@angular/common';
import { Component, Input, Output, EventEmitter } from '@angular/core';
export class ButtonComponent {
/** Is this the principal call to action on the page? */
primary = false;
/** What background color to use */
backgroundColor?: string;
/** How large should the button be? */
size: 'small' | 'medium' | 'large' = 'medium';
/**
* Button contents
*
* @required
*/
label = 'Button';
/** Optional click handler */
onClick = new EventEmitter<Event>();
public get classes(): string[] {
const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
return ['storybook-button', `storybook-button--${this.size}`, mode];
}
}