Modus UI

Stretch Toggle

Web (React)

A segmented control whose thumb stretches and squashes as it travels.

Mono uppercase labels sit on the muted track, and the thumb takes the page background.

Modus / Stretch Toggle

Installation

CLI

npx @modus-ui/cli add stretch-toggle

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/stretch-toggle.tsx.
  3. Paste the code.

Usage

tsx
import { StretchToggle } from "@/components/ui/stretch-toggle";

export default function Example() {
  return <StretchToggle items={["Draft", "Review", "Publish"]} />;
}

Props

PropTypeDefaultDescription
itemsany--
valueany--
defaultValueany--
onChangeany--
trackColorstring"hsl(var(--muted))"-
thumbColorstring"hsl(var(--background))"-
textColorstring"hsl(var(--muted-foreground))"-
activeTextColorstring"hsl(var(--foreground))"-
sizestring"md"-
radiusnumber6-
insetnumber3-
equalSlotsbooleantrue-
stretchnumber100-
squashnumber3-
speednumber1-
glidenumber75-
draggablebooleantrue-
disabledbooleanfalse-
ariaLabelstring"Toggle group"-

Comments

  • No comments yet.