shadcn-templ 2.0 beta. Switch to templUI v1
1.7k

Toggle

A two-state button that can be either on or off.

package examples import (

Installation

shadcn-templ add toggle

Usage

import "github.com/axadrn/shadcn-templ/v2/components/toggle"
@toggle.Toggle() {	Toggle}

Outline

Use Variant: toggle.VariantOutline for an outline style.

package examples import (

With Text

package examples import (

Size

Use the Size prop to change the size of the toggle.

package examples import "github.com/axadrn/shadcn-templ/v2/components/toggle"

Disabled

package examples import "github.com/axadrn/shadcn-templ/v2/components/toggle"

API Reference

Toggle

The Toggle component renders a pressable two-state button.

Prop Type Default
Pressed bool false
Value string -
Variant VariantDefault | VariantOutline default
Size SizeDefault | SizeSm | SizeLg default
Disabled bool false
Class string -