UNPKG

@nebular/theme

Version:
404 lines (403 loc) 15.1 kB
/** * @license * Copyright Akveo. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ import { AfterViewInit, ChangeDetectorRef, ElementRef, Renderer2 } from '@angular/core'; import { NbComponentStatus } from '../component-status'; import { NbComponentShape } from '../component-shape'; import { NbComponentSize } from '../component-size'; export declare type NbButtonAppearance = 'filled' | 'outline' | 'ghost' | 'hero'; /** * Basic button component. * * Default button size is `medium` and status color is `primary`: * @stacked-example(Button Showcase, button/button-showcase.component) * * ```html * <button nbButton></button> * ``` * ### Installation * * Import `NbButtonModule` to your feature module. * ```ts * @NgModule({ * imports: [ * // ... * NbButtonModule, * ], * }) * export class PageModule { } * ``` * ### Usage * * Buttons are available in multiple colors using `status` property: * @stacked-example(Button Colors, button/button-colors.component.html) * * There are three button sizes: * * @stacked-example(Button Sizes, button/button-sizes.component.html) * * And two additional style types - `outline`: * * @stacked-example(Outline Buttons, button/button-outline.component.html) * * and `hero`: * * @stacked-example(Button Colors, button/button-hero.component.html) * * Buttons available in different shapes, which could be combined with the other properties: * @stacked-example(Button Shapes, button/button-shapes.component) * * `nbButton` could be applied to the following selectors - `button`, `input[type="button"]`, `input[type="submit"]` * and `a`: * @stacked-example(Button Elements, button/button-types.component.html) * * Button can be made `fullWidth`: * @stacked-example(Full Width Button, button/button-full-width.component.html) * * Icon can be placed inside of a button as a child element: * @stacked-example(Icon Button, button/button-icon.component.html) * * @additional-example(Interactive example, button/button-interactive.component) * * @styles * * button-cursor: * button-outline-width: * button-outline-color: * button-text-font-family: * button-text-font-weight: * button-disabled-cursor: * button-tiny-text-font-size: * button-tiny-text-line-height: * button-small-text-font-size: * button-small-text-line-height: * button-medium-text-font-size: * button-medium-text-line-height: * button-large-text-font-size: * button-large-text-line-height: * button-giant-text-font-size: * button-giant-text-line-height: * button-rectangle-border-radius: * button-semi-round-border-radius: * button-round-border-radius: * button-filled-border-style: * button-filled-border-width: * button-filled-text-transform: * button-filled-tiny-padding: * button-filled-small-padding: * button-filled-medium-padding: * button-filled-large-padding: * button-filled-giant-padding: * button-filled-primary-background-color: * button-filled-primary-border-color: * button-filled-primary-text-color: * button-filled-primary-focus-border-color: * button-filled-primary-hover-background-color: * button-filled-primary-hover-border-color: * button-filled-primary-active-background-color: * button-filled-primary-active-border-color: * button-filled-primary-disabled-background-color: * button-filled-primary-disabled-border-color: * button-filled-primary-disabled-text-color: * button-filled-success-background-color: * button-filled-success-border-color: * button-filled-success-text-color: * button-filled-success-focus-border-color: * button-filled-success-hover-background-color: * button-filled-success-hover-border-color: * button-filled-success-active-background-color: * button-filled-success-active-border-color: * button-filled-success-disabled-background-color: * button-filled-success-disabled-border-color: * button-filled-success-disabled-text-color: * button-filled-info-background-color: * button-filled-info-border-color: * button-filled-info-text-color: * button-filled-info-focus-border-color: * button-filled-info-hover-background-color: * button-filled-info-hover-border-color: * button-filled-info-active-background-color: * button-filled-info-active-border-color: * button-filled-info-disabled-background-color: * button-filled-info-disabled-border-color: * button-filled-info-disabled-text-color: * button-filled-warning-background-color: * button-filled-warning-border-color: * button-filled-warning-text-color: * button-filled-warning-focus-border-color: * button-filled-warning-hover-background-color: * button-filled-warning-hover-border-color: * button-filled-warning-active-background-color: * button-filled-warning-active-border-color: * button-filled-warning-disabled-background-color: * button-filled-warning-disabled-border-color: * button-filled-warning-disabled-text-color: * button-filled-danger-background-color: * button-filled-danger-border-color: * button-filled-danger-text-color: * button-filled-danger-focus-border-color: * button-filled-danger-hover-background-color: * button-filled-danger-hover-border-color: * button-filled-danger-active-background-color: * button-filled-danger-active-border-color: * button-filled-danger-disabled-background-color: * button-filled-danger-disabled-border-color: * button-filled-danger-disabled-text-color: * button-outline-border-style: * button-outline-border-width: * button-outline-background-color: * button-outline-text-transform: * button-outline-tiny-padding: * button-outline-small-padding: * button-outline-medium-padding: * button-outline-large-padding: * button-outline-giant-padding: * button-outline-primary-border-color: * button-outline-primary-text-color: * button-outline-primary-focus-border-color: * button-outline-primary-focus-text-color: * button-outline-primary-hover-border-color: * button-outline-primary-hover-text-color: * button-outline-primary-active-border-color: * button-outline-primary-active-text-color: * button-outline-primary-disabled-border-color: * button-outline-primary-disabled-text-color: * button-outline-success-border-color: * button-outline-success-text-color: * button-outline-success-focus-border-color: * button-outline-success-focus-text-color: * button-outline-success-hover-border-color: * button-outline-success-hover-text-color: * button-outline-success-active-border-color: * button-outline-success-active-text-color: * button-outline-success-disabled-border-color: * button-outline-success-disabled-text-color: * button-outline-info-border-color: * button-outline-info-text-color: * button-outline-info-focus-border-color: * button-outline-info-focus-text-color: * button-outline-info-hover-border-color: * button-outline-info-hover-text-color: * button-outline-info-active-border-color: * button-outline-info-active-text-color: * button-outline-info-disabled-border-color: * button-outline-info-disabled-text-color: * button-outline-warning-border-color: * button-outline-warning-text-color: * button-outline-warning-focus-border-color: * button-outline-warning-focus-text-color: * button-outline-warning-hover-border-color: * button-outline-warning-hover-text-color: * button-outline-warning-active-border-color: * button-outline-warning-active-text-color: * button-outline-warning-disabled-border-color: * button-outline-warning-disabled-text-color: * button-outline-danger-border-color: * button-outline-danger-text-color: * button-outline-danger-focus-border-color: * button-outline-danger-focus-text-color: * button-outline-danger-hover-border-color: * button-outline-danger-hover-text-color: * button-outline-danger-active-border-color: * button-outline-danger-active-text-color: * button-outline-danger-disabled-border-color: * button-outline-danger-disabled-text-color: * button-ghost-background-color: * button-ghost-border-color: * button-ghost-border-style: * button-ghost-border-width: * button-ghost-text-transform: * button-ghost-tiny-padding: * button-ghost-small-padding: * button-ghost-medium-padding: * button-ghost-large-padding: * button-ghost-giant-padding: * button-ghost-primary-text-color: * button-ghost-primary-focus-text-color: * button-ghost-primary-hover-color: * button-ghost-primary-active-text-color: * button-ghost-primary-disabled-text-color: * button-ghost-success-text-color: * button-ghost-success-focus-text-color: * button-ghost-success-hover-color: * button-ghost-success-active-text-color: * button-ghost-success-disabled-text-color: * button-ghost-info-text-color: * button-ghost-info-focus-text-color: * button-ghost-info-hover-color: * button-ghost-info-active-text-color: * button-ghost-info-disabled-text-color: * button-ghost-warning-text-color: * button-ghost-warning-focus-text-color: * button-ghost-warning-hover-color: * button-ghost-warning-active-text-color: * button-ghost-warning-disabled-text-color: * button-ghost-danger-text-color: * button-ghost-danger-focus-text-color: * button-ghost-danger-hover-color: * button-ghost-danger-active-text-color: * button-ghost-danger-disabled-text-color: * button-hero-border-color: * button-hero-border-style: * button-hero-border-width: * button-hero-text-transform: * button-hero-tiny-padding: * button-hero-small-padding: * button-hero-medium-padding: * button-hero-large-padding: * button-hero-giant-padding: * button-hero-shadow: * button-hero-text-shadow: * button-hero-bevel-size: * button-hero-glow-size: * button-hero-outline-color: * button-hero-outline-width: * button-hero-primary-text-color: * button-hero-primary-bevel-color: * button-hero-primary-glow-color: * button-hero-primary-left-background-color: * button-hero-primary-right-background-color: * button-hero-primary-focus-left-background-color: * button-hero-primary-focus-right-background-color: * button-hero-primary-hover-left-background-color: * button-hero-primary-hover-right-background-color: * button-hero-primary-active-left-background-color: * button-hero-primary-active-right-background-color: * button-hero-primary-disabled-background-color: * button-hero-primary-disabled-text-color: * button-hero-success-text-color: * button-hero-success-bevel-color: * button-hero-success-glow-color: * button-hero-success-left-background-color: * button-hero-success-right-background-color: * button-hero-success-focus-left-background-color: * button-hero-success-focus-right-background-color: * button-hero-success-hover-left-background-color: * button-hero-success-hover-right-background-color: * button-hero-success-active-left-background-color: * button-hero-success-active-right-background-color: * button-hero-success-disabled-background-color: * button-hero-success-disabled-text-color: * button-hero-info-text-color: * button-hero-info-bevel-color: * button-hero-info-glow-color: * button-hero-info-left-background-color: * button-hero-info-right-background-color: * button-hero-info-focus-left-background-color: * button-hero-info-focus-right-background-color: * button-hero-info-hover-left-background-color: * button-hero-info-hover-right-background-color: * button-hero-info-active-left-background-color: * button-hero-info-active-right-background-color: * button-hero-info-disabled-background-color: * button-hero-info-disabled-text-color: * button-hero-warning-text-color: * button-hero-warning-bevel-color: * button-hero-warning-glow-color: * button-hero-warning-left-background-color: * button-hero-warning-right-background-color: * button-hero-warning-focus-left-background-color: * button-hero-warning-focus-right-background-color: * button-hero-warning-hover-left-background-color: * button-hero-warning-hover-right-background-color: * button-hero-warning-active-left-background-color: * button-hero-warning-active-right-background-color: * button-hero-warning-disabled-background-color: * button-hero-warning-disabled-text-color: * button-hero-danger-text-color: * button-hero-danger-bevel-color: * button-hero-danger-glow-color: * button-hero-danger-left-background-color: * button-hero-danger-right-background-color: * button-hero-danger-focus-left-background-color: * button-hero-danger-focus-right-background-color: * button-hero-danger-hover-left-background-color: * button-hero-danger-hover-right-background-color: * button-hero-danger-active-left-background-color: * button-hero-danger-active-right-background-color: * button-hero-danger-disabled-background-color: * button-hero-danger-disabled-text-color: */ export declare class NbButtonComponent implements AfterViewInit { protected renderer: Renderer2; protected hostElement: ElementRef<HTMLElement>; protected cd: ChangeDetectorRef; protected isInitialized: boolean; /** * Button size, available sizes: * `tiny`, `small`, `medium`, `large`, `giant` */ size: NbComponentSize; /** * Button status (adds specific styles): * `primary`, `info`, `success`, `warning`, `danger` */ status: NbComponentStatus; /** * Button shapes: `rectangle`, `round`, `semi-round` */ shape: NbComponentShape; /** * Button appearance: `filled`, `outline`, `ghost`, `hero` */ appearance: NbButtonAppearance; /** * Sets `filled` appearance */ filled: boolean; /** * Sets `outline` appearance */ outline: boolean; /** * Sets `ghost` appearance */ ghost: boolean; /** * Sets `hero` appearance */ hero: boolean; /** * If set element will fill its container */ fullWidth: boolean; private _fullWidth; /** * Disables the button */ disabled: boolean; private _disabled; readonly tabbable: string; readonly tiny: boolean; readonly small: boolean; readonly medium: boolean; readonly large: boolean; readonly giant: boolean; readonly primary: boolean; readonly info: boolean; readonly success: boolean; readonly warning: boolean; readonly danger: boolean; readonly rectangle: boolean; readonly round: boolean; readonly semiRound: boolean; readonly iconLeft: boolean; readonly iconRight: boolean; readonly transitions: boolean; /** * @private * Keep this handler to partially support anchor disabling. * Unlike button, anchor doesn't have 'disabled' DOM property, * so handler will be called anyway. We preventing navigation and bubbling. * Disabling is partial due to click handlers precedence. Consider example: * <a nbButton [disabled]="true" (click)="clickHandler()">...</a> * 'clickHandler' will be called before our host listener below. We can't prevent * such handlers call. */ onClick(event: Event): void; constructor(renderer: Renderer2, hostElement: ElementRef<HTMLElement>, cd: ChangeDetectorRef); ngAfterViewInit(): void; protected readonly iconElement: Element; }