2023-03-01 08:50:01 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Button is an extension to standard button element with icons and theming.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/button/)
|
|
|
|
*
|
|
|
|
* @module button
|
|
|
|
*
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ButtonHTMLAttributes, VNode } from 'vue';
|
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
2023-04-24 12:00:20 +00:00
|
|
|
export declare type ButtonPassThroughOptionType = ButtonPassThroughAttributes | ((options: ButtonPassThroughMethodOptions) => ButtonPassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface ButtonPassThroughMethodOptions {
|
|
|
|
props: ButtonProps;
|
2023-06-23 10:05:40 +00:00
|
|
|
context: ButtonContext;
|
2023-04-24 12:00:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link ButtonProps.pt}
|
|
|
|
*/
|
|
|
|
export interface ButtonPassThroughOptions {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: ButtonPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the loading icon's DOM element.
|
|
|
|
*/
|
|
|
|
loadingIcon?: ButtonPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the icon's DOM element.
|
|
|
|
*/
|
|
|
|
icon?: ButtonPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the label's DOM element.
|
|
|
|
*/
|
|
|
|
label?: ButtonPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the badge's DOM element.
|
|
|
|
*/
|
|
|
|
badge?: ButtonPassThroughOptionType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface ButtonPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:01 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Button component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ButtonProps extends ButtonHTMLAttributes {
|
|
|
|
/**
|
|
|
|
* Inline style of the button.
|
|
|
|
*/
|
|
|
|
style?: any;
|
|
|
|
/**
|
2022-09-14 11:26:01 +00:00
|
|
|
* Style class of the button.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
class?: any;
|
|
|
|
/**
|
|
|
|
* Text of the button.
|
|
|
|
*/
|
|
|
|
label?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Name of the icon.
|
|
|
|
*/
|
|
|
|
icon?: string | undefined;
|
|
|
|
/**
|
2023-03-01 08:50:01 +00:00
|
|
|
* Position of the icon.
|
2023-03-08 08:27:20 +00:00
|
|
|
* @defaultValue left
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 08:50:01 +00:00
|
|
|
iconPos?: 'left' | 'right' | 'top' | 'bottom' | undefined;
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
iconClass?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Value of the badge.
|
|
|
|
*/
|
|
|
|
badge?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Style class of the badge.
|
|
|
|
*/
|
|
|
|
badgeClass?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Whether the button is in loading state.
|
2023-03-01 08:50:01 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
loading?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in loading state.
|
|
|
|
*/
|
|
|
|
loadingIcon?: string | undefined;
|
2023-03-03 07:03:54 +00:00
|
|
|
/**
|
|
|
|
* Add a link style to the button.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
link?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Defines the style of the button.
|
|
|
|
*/
|
2023-03-27 08:09:36 +00:00
|
|
|
severity?: 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | string | undefined;
|
2023-03-03 07:03:54 +00:00
|
|
|
/**
|
|
|
|
* Add a shadow to indicate elevation.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
raised?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Add a circular border radius to the button.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
rounded?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Add a textual class to the button without a background initially.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
text?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Add a border class without a background initially.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
outlined?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Defines the size of the button.
|
|
|
|
*/
|
|
|
|
size?: 'small' | 'large' | undefined;
|
2023-03-06 08:14:59 +00:00
|
|
|
/**
|
|
|
|
* Add a plain textual class to the button without a background initially.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
plain?: boolean | undefined;
|
2023-04-24 12:00:20 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {ButtonPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: ButtonPassThroughOptions;
|
2023-05-30 14:05:57 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-06-23 10:05:40 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in Button component.
|
|
|
|
*/
|
|
|
|
export interface ButtonContext {
|
|
|
|
/**
|
|
|
|
* Current disabled state of the element as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
disabled: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:01 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Button component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ButtonSlots {
|
|
|
|
/**
|
|
|
|
* Custom content such as icons, images and text can be placed inside the button via the default slot. Note that when slot is used, label, icon and badge properties are not included.
|
|
|
|
*/
|
2023-03-01 08:50:01 +00:00
|
|
|
default(): VNode[];
|
2023-04-13 09:19:28 +00:00
|
|
|
/**
|
|
|
|
* Custom icon template.
|
|
|
|
* @param {Object} scope - icon slot's params.
|
|
|
|
*/
|
|
|
|
icon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom loading icon template.
|
|
|
|
* @param {Object} scope - loading icon slot's params.
|
|
|
|
*/
|
|
|
|
loadingicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the loading icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:01 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Button component.
|
|
|
|
*/
|
|
|
|
export interface ButtonEmits {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 08:50:01 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Button**
|
|
|
|
*
|
|
|
|
* _Button is an extension to standard button element with icons and theming._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/button/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*/
|
2023-03-01 14:48:23 +00:00
|
|
|
declare class Button extends ClassComponent<ButtonProps, ButtonSlots, ButtonEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Button: GlobalComponentConstructor<Button>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Button;
|