Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Toggle

A button that stays pressed until pressed again.

Built on the headless Toggle.See its API in Docs

Rendered by React 19.3.1

toggle.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/toggle.json

It also adds utils. The app needs its setup first: Installation.

Usage

It is the headless Toggle: pressed or defaultPressed. variant="outline" gives it a border and size its height.

import { Toggle } from '@/components/ui/toggle'

Examples

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Toggle's API reference.