mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 15:31:16 +08:00
44 lines
699 B
Plaintext
44 lines
699 B
Plaintext
```ts
|
|
// Button.component.ts
|
|
|
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
|
|
@Component({
|
|
selector: 'button',
|
|
template: `the component implementation markup`,
|
|
})
|
|
export class ButtonComponent {
|
|
/**
|
|
* Is this the principal call to action on the page?
|
|
*/
|
|
@Input()
|
|
primary = false;
|
|
|
|
/**
|
|
* What background color to use
|
|
*/
|
|
@Input()
|
|
backgroundColor?: string;
|
|
|
|
/**
|
|
* How large should the button be?
|
|
*/
|
|
@Input()
|
|
size: 'small' | 'medium' | 'large' = 'medium';
|
|
|
|
/**
|
|
* Button contents
|
|
*
|
|
* @required
|
|
*/
|
|
@Input()
|
|
label = 'Button';
|
|
|
|
/**
|
|
* Optional click handler
|
|
*/
|
|
@Output()
|
|
onClick = new EventEmitter<Event>();
|
|
}
|
|
```
|