@keenmate/svelte-switch
Version:
A modern, customizable switch component for Svelte 5 with support for both binary and multi-step switches
36 lines (35 loc) • 1.05 kB
TypeScript
type Orientation = "horizontal" | "vertical";
interface StepStyle {
backgroundColor?: string;
thumbColor?: string;
thumbBorderColor?: string;
}
interface Props {
checked?: boolean;
isDisabled?: boolean;
orientation?: Orientation;
size?: number;
items?: any[] | null;
itemStyles?: StepStyle[] | StepStyle;
onToggle?: (checked: boolean) => void;
children?: import("svelte").Snippet<[
{
currentIndex: number;
item: any;
isSelected: boolean;
}
]>;
thumbTemplate?: import("svelte").Snippet<[
{
currentIndex: number;
currentItem: any;
itemsCount: number;
}
]>;
disableThumbRender?: boolean;
}
declare const Switch: import("svelte").Component<Props, {
update: (updates: Partial<Pick<Props, "checked" | "isDisabled" | "orientation" | "size" | "items" | "itemStyles" | "onToggle" | "disableThumbRender">>) => void;
}, "checked">;
type Switch = ReturnType<typeof Switch>;
export default Switch;