Skip to content

    Browse components

    Squash Toggle

    Toggle switch whose thumb widens in anticipation while pressed, stretches and flattens as it travels, then bounces into place.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/squash-toggle

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/squash-toggle.json

    Usage

    import { SquashToggle } from "@/components/ui/squash-toggle";
    
    <SquashToggle label="Airplane mode" checked={airplane} onChange={setAirplane} />

    Props

    PropTypeDefaultDescription
    labelstring"Airplane mode"Visible label and accessible name.
    defaultCheckedbooleanfalseInitial state when uncontrolled.
    colorstring"#22c55e"Track color when on.
    bouncenumber0.6Spring bounciness.
    disabledbooleanfalseDisable the switch.
    checkedReactNode—Controlled state, pair with onChange.
    onChangeReactNode—(checked: boolean) => void.
    classNamestring—Extra classes for the root element.