@nextcloud/vue
Version:
Nextcloud vue components
79 lines (78 loc) • 3.04 kB
TypeScript
import { AnchorHTMLAttributes, ButtonHTMLAttributes, MaybeRef } from 'vue';
import { RouteLocationRaw } from 'vue-router';
type ButtonLinkProps = {
/**
* RouterLink's to props and a trigger to use RouterLink.
* Note: This takes precedence over the href attribute.
*/
to: MaybeRef<RouteLocationRaw | undefined>;
/**
* HyperLink href attribute and a trigger to use <a> hyperlink.
*/
href: MaybeRef<string | undefined>;
/**
* Define additional attributes, based on the tag
*/
additionalAttrs?: (tag: 'RouterLink' | 'a' | 'button') => object | undefined;
/**
* RouterLink's activeClass prop
*/
activeClass?: MaybeRef<string | undefined>;
/**
* <a> hyperlink's target attribute
*/
target?: MaybeRef<AnchorHTMLAttributes['target'] | undefined>;
/**
* <a> hyperlink's download attribute
*/
download?: MaybeRef<string | boolean | undefined>;
/**
* <button> element's type attribute, but default to "button" instead of "submit"
*/
type?: MaybeRef<ButtonHTMLAttributes['type'] | undefined>;
/**
* <button> element's disabled attribute
*/
disabled?: MaybeRef<boolean | undefined>;
};
/**
* Reusable implementation of an interactive button-like element that can be a link or a button
*
* @param options - Props to determine the button/link behavior. Can be a reactive object, or an object with nested refs, or mixed.
*/
export declare function useButtonLink(options: ButtonLinkProps): {
tag: import('vue').ComputedRef<"button" | "RouterLink" | "a">;
isLink: import('vue').ComputedRef<boolean>;
isHyperLink: import('vue').ComputedRef<boolean>;
isRouterLink: import('vue').ComputedRef<boolean>;
isButton: import('vue').ComputedRef<boolean>;
attrs: import('vue').ComputedRef<{
to: string | import('vue-router').RouteLocationAsRelativeGeneric | import('vue-router').RouteLocationAsPathGeneric | {
name?: import('vue-router').RouteRecordNameGeneric;
params?: import('vue-router').RouteParamsRawGeneric | undefined;
path?: undefined | undefined;
query?: import('vue-router').LocationQueryRaw | undefined;
hash?: string | undefined;
replace?: boolean | undefined;
force?: boolean | undefined;
state?: import('vue-router').HistoryState | undefined;
} | {
path: string;
query?: import('vue-router').LocationQueryRaw | undefined;
hash?: string | undefined;
replace?: boolean | undefined;
force?: boolean | undefined;
state?: import('vue-router').HistoryState | undefined;
} | undefined;
activeClass: string;
} | {
href: string | undefined;
target: string | undefined;
download: string | true | undefined;
rel: string;
} | {
type: "submit" | "button" | "reset";
disabled: boolean | undefined;
} | undefined>;
};
export {};