Presenting Sillybits Pro - Beautifully crafted templates to create stunning landing pages in no time.
Docs
Toggle Button

Toggle Button

PreviousNext

A reusable toggle switch component that smoothly transitions between on and off states.

Installation

Examples

Basic Toggle

Usage

import { useState } from "react";
import { ToggleButton } from "@/components/sillybitsui/toggle-button";
function Example() {
  const [isOn, setIsOn] = useState(false);
 
  return <ToggleButton isOn={isOn} handleToggle={() => setIsOn(!isOn)} />;
}

Props

PropTypeDefaultDescription
classNamestring-Additional classes to style the button.
isOnbooleanfalseControls whether the toggle is in the “on” state.
handleToggle() => void-Callback triggered when the toggle is clicked.