Register Custom Shape. Declare its options on ShapeRegistry first; the name then becomes a typed shapes[].type. Registering the same name again replaces the definition.
shapes[].type
Shape Type Name (not a built-in name)
Path- or Draw-Based Definition
TypeError for built-in names
declare module "konfeti" { interface ShapeRegistry { diamond: { sharpness?: number }; }}defineShape("diamond", { path: ({ sharpness = 0.5 }) => `M12 0L${24 - sharpness * 12} 12L12 24L${sharpness * 12} 12Z`,});Konfeti.fire({ shapes: [{ type: "diamond", sharpness: 0.8 }] }); Copy
declare module "konfeti" { interface ShapeRegistry { diamond: { sharpness?: number }; }}defineShape("diamond", { path: ({ sharpness = 0.5 }) => `M12 0L${24 - sharpness * 12} 12L12 24L${sharpness * 12} 12Z`,});Konfeti.fire({ shapes: [{ type: "diamond", sharpness: 0.8 }] });
Register Custom Shape. Declare its options on ShapeRegistry first; the name then becomes a typed
shapes[].type. Registering the same name again replaces the definition.