@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
26 lines (25 loc) • 774 B
TypeScript
import { FileMimeType } from '@zag-js/file-utils';
import { MaybeRefOrGetter } from 'vue';
import { MaybePromise } from '../../types.js';
export type DownloadableData = string | Blob | File;
export interface UseDownloadProps {
/**
* The name of the file to download
*/
fileName: string;
/**
* The MIME type of the data to download
*/
mimeType: FileMimeType;
/**
* The data to download
*/
data: DownloadableData | (() => MaybePromise<DownloadableData>);
}
export interface UseDownloadReturn {
/**
* Triggers the download, resolving `data` first if it's a function or promise.
*/
download: () => void;
}
export declare const useDownload: (props: MaybeRefOrGetter<UseDownloadProps>) => UseDownloadReturn;