Skip to content
aq-ui
Back to ComponentsComponent

Switch

Open-code aq-ui accessible component family for Switch.

Preview

This is a live example. Interact with the available controls and use the keyboard to inspect the component's states and behavior.

Loading interactive preview…

Installation

pnpm dlx aq-ui@alpha add switch

API reference

Client module

Import the parts you need, then jump to an export for its contract.

View full source

Quick start

"use client"

import { Switch } from "@/components/ui/switch"

<Switch />

Switch

constSource L9

Open-code aq-ui accessible component family for Switch.

const Switch = React.forwardRef<React.ComponentRef<typeof SwitchPrimitive.Root>, SwitchPrimitive.Root.Props & { size?: "sm" | "default" }>(…)
Props type
SwitchPrimitive.Root.Props & { size?: "sm" | "default" }

Props

NameTypeDefault
size?"sm" | "default""default"
<Switch />

Registry dependencies

utils

Package dependencies

@base-ui/react@^1.7.0

Files

  • components/ui/switch.tsx

Source