Skip to content

Commit 8eb5c04

Browse files
committed
feat(prompts/spinner): custom spinner indicator
Signed-off-by: Alexander Mangel <[email protected]>
1 parent 5529c89 commit 8eb5c04

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/prompts/src/index.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -720,13 +720,19 @@ export const stream = {
720720
},
721721
};
722722

723+
export interface CustomIndicator {
724+
frames: string[];
725+
speed?: number;
726+
}
727+
723728
export interface SpinnerOptions {
724-
indicator?: 'dots' | 'timer';
729+
indicator?: 'dots' | 'timer' | 'custom';
730+
custom?: CustomIndicator
725731
}
726732

727-
export const spinner = ({ indicator = 'dots' }: SpinnerOptions = {}) => {
728-
const frames = unicode ? ['◒', '◐', '◓', '◑'] : ['•', 'o', 'O', '0'];
729-
const delay = unicode ? 80 : 120;
733+
export const spinner = ({ indicator = 'dots', custom }: SpinnerOptions = {}) => {
734+
const frames = custom?.frames ? custom.frames : unicode ? ['◒', '◐', '◓', '◑'] : ['•', 'o', 'O', '0'];
735+
const delay = custom?.speed ? custom?.speed : unicode ? 80 : 120;
730736
const isCI = process.env.CI === 'true';
731737

732738
let unblock: () => void;

0 commit comments

Comments
 (0)