@nextcloud/vue
Version:
Nextcloud vue components
150 lines (149 loc) • 4.95 kB
TypeScript
import { Slot } from 'vue';
import { RouteLocationRaw } from 'vue-router';
export type ButtonAlignment = 'start' | 'start-reverse' | 'center' | 'center-reverse' | 'end' | 'end-reverse';
export type ButtonSize = 'small' | 'normal' | 'large';
export type ButtonType = 'submit' | 'reset' | 'button';
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'tertiary-no-background' | 'tertiary-on-primary' | 'error' | 'warning' | 'success';
type __VLS_Props = {
/**
* Set the text and icon alignment
*
* @default 'center'
*/
alignment?: ButtonAlignment;
/**
* Always try to provide an aria-label to your button.
*
* Make it more specific than the button's name by provide some more context.
* E.g. if the name of the button is "send" in the Mail app,
* the aria label could be "Send email".
*/
ariaLabel?: string;
/**
* Toggles the disabled state of the button on and off.
*
* @default false
*/
disabled?: boolean;
/**
* When `href` is set this will make the browser try to download the target.
* If a string is passed the browser will use it as the filename.
*
* Note that the browser might adjust it for allowed characters (e.g. '/' or '\').
* Also this only works with same-origin URLs and `blob:` or `data:` schemas.
* Moreover a `Content-Disposition` header set by the server will override the filename.
*/
download?: string | true;
/**
* Providing the href attribute turns the button component into an `a` element.
*/
href?: string;
/**
* The pressed state of the button if it has a checked state.
* This will add the `aria-pressed` attribute and for the button to have the primary style in checked state.
*
* Note: Pressed state is not supported for links.
*/
pressed?: boolean | undefined;
/**
* Specify the button size.
*
* @default 'normal'
*/
size?: ButtonSize;
/**
* Target for the `a` element if `href` is set.
*
* @default '_self'
*/
target?: string;
/**
* The main button text.
* This can be overwritten by using the *default* slot.
*
* @since 9.0.0
*/
text?: string;
/**
* Providing the to attribute turns the button component into a `router-link` element.
*
* Note: This takes precedence over the href attribute.
*/
to?: RouteLocationRaw;
/**
* Specifies the button native type
* If left empty, the default "button" type will be used.
*
* @default 'button'
*/
type?: ButtonType;
/**
* Specifies the button variant.
* If left empty, the default button style will be applied.
*
* @default 'secondary'
*/
variant?: ButtonVariant;
/**
* Specifies whether the button should span all the available width.
* By default, buttons span the whole width of the container.
*
* @default false
*/
wide?: boolean;
};
declare function __VLS_template(): {
attrs: Partial<{}>;
slots: Readonly<{
/**
* Custom button content.
* This can be used for custom formatted content, ensure to not include any interactive elements.
* For plain text it is preferred to use the `text` prop instead.
*/
default?: Slot;
/**
* Icon (optional) to show within the button
*/
icon?: Slot;
}> & {
/**
* Custom button content.
* This can be used for custom formatted content, ensure to not include any interactive elements.
* For plain text it is preferred to use the `text` prop instead.
*/
default?: Slot;
/**
* Icon (optional) to show within the button
*/
icon?: Slot;
};
refs: {};
rootEl: any;
};
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
click: (e: MouseEvent) => any;
"update:pressed": (pressed: boolean) => any;
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
onClick?: ((e: MouseEvent) => any) | undefined;
"onUpdate:pressed"?: ((pressed: boolean) => any) | undefined;
}>, {
size: ButtonSize;
type: ButtonType;
text: string;
alignment: ButtonAlignment;
ariaLabel: string;
download: string | true;
href: string;
pressed: boolean;
target: string;
to: RouteLocationRaw;
variant: ButtonVariant;
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};