ReScript Shadcn
Get started
  • Installation
Components
  • Accordion
  • Alert
  • AlertDialog
  • AspectRatio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • ContextMenu
  • DataTable
  • DatePicker
  • Dialog
  • Direction
  • Drawer
  • DropdownMenu
  • Empty
  • Field
  • HoverCard
  • Input
  • InputGroup
  • InputOtp
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • MessageScroller
  • NativeSelect
  • NavigationMenu
  • Pagination
  • Popover
  • Progress
  • RadioGroup
  • Resizable
  • ScrollArea
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • ToggleGroup
  • Tooltip
  • Typography

Toggle

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

Installation#

npx shadcn@latest add @rescript-shadcn/Toggle

Usage#

<Toggle> {"Toggle"->React.string} </Toggle>

Examples#

Outline#

Use variant=Outline for an outline style.

With Text#

Size#

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

Disabled#

API Reference#

See the Base UI Toggle documentation.

@react.component
let make = () =>
  <Toggle ariaLabel="Toggle bookmark" size=Toggle.Size.Sm variant=Outline>
@react.component
let make = () =>
  <div className="flex flex-wrap items-center gap-2">
@react.component
let make = () =>
  <Toggle ariaLabel="Toggle italic">
@react.component
let make = () =>
  <div className="flex flex-wrap items-center gap-2">
@react.component
let make = () =>
  <div className="flex flex-wrap items-center gap-2">