Command Palette

Search for a command to run...

331K21st.dev views
Components

Avatar Gender Toggle

An expressive illustrated character pill switch that smoothly morphs between Female and Male personas with spring physics, idle micro-animations, and vertical-wipe labels.

Loading…
Dependencies (2)

Features

  • Topology-matched cubic Bezier paths that morph hair bangs and round-to-wayfarer eyewear frames seamlessly.
  • Vertical spring-animated face travel inside a cylindrical 3D-shaded pill track.
  • Signature idle micro-animations: diagonal specular lens glint in Female state and natural eye blink in Male state.
  • Interactive vertical-wipe Female / Male radio labels with full dark/light mode support and prefers-reduced-motion accessibility.

Use cases

  • Onboarding flows, character creators, and profile preference forms.
  • Playful binary persona or theme switches that benefit from tactile, illustrative feedback.

Installation

pnpm dlx shadcn@latest add @abushaidislam/avatar-gender-toggle

Usage

import { AvatarGenderToggle } from "@/components/avatar-gender-toggle"
export default function ProfileGenderPicker() {
  return (
    <div className="flex min-h-95 items-center justify-center p-8">
      <AvatarGenderToggle defaultValue="female" size="md" />
    </div>
  )
}

API reference

AvatarGenderToggle

Prop

Type

Accessibility

  • Exposes role="radiogroup" on the root container, role="switch" on the illustrated pill button, and role="radio" on the interactive labels.
  • Supports ArrowUp / ArrowLeft, ArrowDown / ArrowRight, Space, and Enter keyboard navigation.
  • Respects prefers-reduced-motion by disabling idle animations and snapping transitions immediately.

License and usage

  • Free to use and modify in both personal and commercial projects.
  • Attribution is appreciated but not required.
  • Released under the MIT License.

Was this helpful?

Command Palette

Search for a command to run...